[SDM 2022] Towards Similarity-Aware Time-Series Classification

Related tags

Deep Learning SimTSC
Overview

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. overview

Installation

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

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

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
You might also like...
A variational Bayesian method for similarity learning in non-rigid image registration (CVPR 2022)
A variational Bayesian method for similarity learning in non-rigid image registration (CVPR 2022)

A variational Bayesian method for similarity learning in non-rigid image registration We provide the source code and the trained models used in the re

PyTorch implementation of Weak-shot Fine-grained Classification via Similarity Transfer
PyTorch implementation of Weak-shot Fine-grained Classification via Similarity Transfer

SimTrans-Weak-Shot-Classification This repository contains the official PyTorch implementation of the following paper: Weak-shot Fine-grained Classifi

[CVPR 2022] CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation

CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation Prerequisite Please create and activate the following conda envrionment. To r

Nonuniform-to-Uniform Quantization: Towards Accurate Quantization via Generalized Straight-Through Estimation. In CVPR 2022.
Nonuniform-to-Uniform Quantization: Towards Accurate Quantization via Generalized Straight-Through Estimation. In CVPR 2022.

Nonuniform-to-Uniform Quantization This repository contains the training code of N2UQ introduced in our CVPR 2022 paper: "Nonuniform-to-Uniform Quanti

Official implementation of
Official implementation of "Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets" (CVPR2021)

Towards Good Practices for Efficiently Annotating Large-Scale Image Classification Datasets This is the official implementation of "Towards Good Pract

TransPrompt - Towards an Automatic Transferable Prompting Framework for Few-shot Text Classification
TransPrompt - Towards an Automatic Transferable Prompting Framework for Few-shot Text Classification

TransPrompt This code is implement for our EMNLP 2021's paper 《TransPrompt:Towards an Automatic Transferable Prompting Framework for Few-shot Text Cla

[CVPR 2022] Official code for the paper:
[CVPR 2022] Official code for the paper: "A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved Neural Network Calibration"

MDCA Calibration This is the official PyTorch implementation for the paper: "A Stitch in Time Saves Nine: A Train-Time Regularizing Loss for Improved

Official Tensorflow implementation of
Official Tensorflow implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Detection"

M-LSD: Towards Light-weight and Real-time Line Segment Detection Official Tensorflow implementation of "M-LSD: Towards Light-weight and Real-time Line

Pytorch implementation of
Pytorch implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Detection"

M-LSD: Towards Light-weight and Real-time Line Segment Detection Pytorch implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Det

Comments
  • 请问代码中在哪里调unlabelled data的比例?

    请问代码中在哪里调unlabelled data的比例?

    您好,最近拜读了你们的文章,想在别的数据集上复现一下。然后我对inductive learning这部分比较感兴趣,看你们文章中意思是包含了所有train split里面没有按few shot learning标记上的数据。但是在看代码的时候,没有找到是在哪里切换supervised learning和inductive learning,所以想在这里问一下,谢谢了!

    opened by ziyuanzhao2000 7
  • 您好,对于大数据集如何构造相似度矩阵

    您好,对于大数据集如何构造相似度矩阵

    作者您好,最近有幸拜读了您的论文,想在自己的工业数据上实践一下,发现有一个比较棘手的问题。 公式(3.6)是建立我们时序相似度的矩阵,矩阵的大小为N*N,如果我没理解错的话N代表的是序列的数量,那如果我想要计算一些比较大(10W条以上的数据量)的数据集的相似度矩阵的话,可能就会出现内存不足的报错,想请问一下这样的实际情况是否有一些针对性的方法呢

    附上我用自己数据及创建dtw矩阵报错的信息 MemoryError: Unable to allocate 1.02 TiB for an array with shape (374147, 374147) and data type float64

    opened by yangye19960922 3
  • About pydw

    About pydw

    I follow your note, but there are some trouble with me. 1 I can't install pydtw, it It prompts such errors image

    2 the link of "dtw" file is removed, can I find it somewhere else?

    opened by Sample-design-alt 19
Owner
Daochen Zha
PhD student in Machine Learning and Data Mining
Daochen Zha
TensorFlow Similarity is a python package focused on making similarity learning quick and easy.

TensorFlow Similarity is a python package focused on making similarity learning quick and easy.

null 912 Jan 8, 2023
Sharpened cosine similarity torch - A Sharpened Cosine Similarity layer for PyTorch

Sharpened Cosine Similarity A layer implementation for PyTorch Install At your c

Brandon Rohrer 203 Nov 30, 2022
Imposter-detector-2022 - HackED 2022 Team 3IQ - 2022 Imposter Detector

HackED 2022 Team 3IQ - 2022 Imposter Detector By Aneeljyot Alagh, Curtis Kan, Jo

Joshua Ji 3 Aug 20, 2022
Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy" (ICLR 2022 Spotlight)

About Code release for Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy (ICLR 2022 Spotlight)

THUML @ Tsinghua University 221 Dec 31, 2022
MINIROCKET: A Very Fast (Almost) Deterministic Transform for Time Series Classification

MINIROCKET: A Very Fast (Almost) Deterministic Transform for Time Series Classification

null 187 Dec 26, 2022
tsai is an open-source deep learning package built on top of Pytorch & fastai focused on state-of-the-art techniques for time series classification, regression and forecasting.

Time series Timeseries Deep Learning Pytorch fastai - State-of-the-art Deep Learning with Time Series and Sequences in Pytorch / fastai

timeseriesAI 2.8k Jan 8, 2023
ICML 21 - Voice2Series: Reprogramming Acoustic Models for Time Series Classification

Voice2Series-Reprogramming Voice2Series: Reprogramming Acoustic Models for Time Series Classification International Conference on Machine Learning (IC

null 49 Jan 3, 2023
Library for implementing reservoir computing models (echo state networks) for multivariate time series classification and clustering.

Framework overview This library allows to quickly implement different architectures based on Reservoir Computing (the family of approaches popularized

Filippo Bianchi 249 Dec 21, 2022
A real world application of a Recurrent Neural Network on a binary classification of time series data

What is this This is a real world application of a Recurrent Neural Network on a binary classification of time series data. This project includes data

Josep Maria Salvia Hornos 2 Jan 30, 2022