Get Start
Inspired by Jiang et al., I realized that any pattern-matching algorithm based on dynamic programming can theoretically be transformed into an equivalent or approximate recurrent neural network. This transformation could then be applied to tackle sample classification problems in scenarios like cold-start, interpretability, knowledge-driven tasks, and low-resource settings.
In the field of time series classification, the classic dynamic time warping algorithm is essentially a pattern-matching algorithm based on dynamic programming. This project provides a concrete implementation of transforming dynamic time warping into a neural network.
Requirements
- arff2pandas 1.0.1
- matplotlib 3.5.0
- numpy 1.21.4
- pandas 1.4.3
- scipy 1.9.3
- sklearn 0.0
- torch 1.10.0+cu113
- tqdm 4.61.2
Data
The UCR datasets can be downloaded here: UCR Time Series Classification Archive
You can download and extract the zip file, and replace the original data directory. The directory structure should be:
1 | . |
Run
There are two main entry files:
1 | main.py |
The main experimental results are generated by main.py, and the main_imbalance.py generates the results for imbalanced settings.
If you have downloaded UCR data and place them into the right location, run:
1 | python main.py --dataset ECG5000 --lr 0.05 --batch_size 2000 --k_shot 10 --scaling_rate 0.5 |