GitXplorerGitXplorer
d

SimTSC

public
73 stars
17 forks
7 issues

Commits

List of commits on branch main.
Unverified
f269c4d3445f09765d1ab5dd474392c40dbef2ae

Add pre-computed DTW

ddaochenzha committed a year ago
Verified
db6ebb9b7ce4b58f0e25781ba42982fea06d72e1

Update README.md

ddaochenzha committed a year ago
Verified
af766d9d301a01aa37e0dd2ba2bf7f5b37e6501a

Update README.md

ddaochenzha committed 2 years ago
Verified
eb6d9482e49ee8b8d1d2d3319b28c4e44de104a3

Update README.md

ddaochenzha committed 2 years ago
Unverified
6e3200510e8e464049eab95db9540afdaf397f9c

Add license

ddaochenzha committed 3 years ago
Unverified
be172b7fb446edc737a83fac5868a98e25799e2c

update readme

ddaochenzha committed 3 years ago

README

The README file for this repository.

SimTSC

This is the PyTorch implementation of SDM2022 paper Towards Similarity-Aware Time-Series Classification. We propose Similarity-Aware Time-Series Classification (SimTSC), a conceptually simple and general framework that models similarity information with graph neural networks (GNNs). We formulate time-series classification as a node classification problem in graphs, where the nodes correspond to time-series, and the links correspond to pair-wise similarities.

📢 Miscellaneous Resources: Please check out our data-centric AI survey and awesome data-centric AI resources!

overview

Installation

Please ensure to use Python 3.6. Python 3.7+ is not supported.

pip3 install -r requirements.txt

Datasets

We provide an example dataset Coffee in this repo. You may download the full UCR datasets here. Multivariate datasets are provided in this link.

Quick Start

We use Coffee as an example to show how to run the code. You may easily try other datasets with arguments --dataset. We will show how to get the results for DTW+1NN, ResNet, and SimTSC.

First, prepare the dataset with (the generated dataset is already available in this repo)

python3 create_dataset.py

Then install the python wrapper of UCR DTW library with

git clone https://github.com/daochenzha/pydtw.git
cd pydtw
pip3 install -e .
cd ..

Then compute the dtw matrix for Coffee with (the dtw matrix is already available in this repo)

python3 create_dtw.py
  1. For DTW+1NN:
python3 train_knn.py
  1. For ResNet:
python3 train_resnet.py
  1. For SimTSC:
python3 train_simtsc.py

All the logs will be saved in logs/

Multivariate Datasets Quick Start

  1. Download the datasets and pre-computed DTW with this link.

  2. Unzip the file and put it into datasets/ folder

  3. Prepare the datasets with

python3 create_dataset.py --dataset CharacterTrajectories
  1. For DTW+1NN:
python3 train_knn.py --dataset CharacterTrajectories
  1. For ResNet:
python3 train_resnet.py --dataset CharacterTrajectories
  1. For SimTSC:
python3 train_simtsc.py --dataset CharacterTrajectories

Descriptions of the Files

  1. create_dataset.py is a script to pre-process dataset and save them into npy. Some important hyperparameters are as follows.
  • --dataset: what dataset to process
  • --shot: how many training labels are given in each class
  1. create_dtw.py is a script to calculate pair-wise DTW distances of a dataset and save them into npy. Some important hyperparameters are as follows.
  • --dataset: what dataset to process
  1. train_knn.py is a script to do classfication DTW+1NN of a dataset. Some important hyperparameters are as follows.
  • --dataset: what dataset we operate on
  • --shot: how many training labels are given in each class
  1. train_resnet.py is a script to do classfication of a dataset with ResNet. Some important hyperparameters are as follows.
  • --dataset: what dataset we operate on
  • --shot: how many training labels are given in each class
  • --gpu: which GPU to use
  1. train_simtsc.py is a script to do classfication of a dataset with SimTSC. Some important hyperparameters are as follows.
  • --dataset: what dataset we operate on
  • --shot: how many training labels are given in each class
  • --gpu: which GPU to use
  • --K: number of neighbors per node in the constructed graph
  • --alpha: the scaling factor of the weights of the constructed graph