Skip to content

uchidalab/shapelet-matching

Repository files navigation

Shapelet-Matching

This repository is for easy implementation of Shapelet Matching, extension of the privious work, and the previous version of this research is available in arXiv.

Multi-source Transfer Learning

Multi-source Transfer Learning

Docker

cd docker
docker build -t transferlearn .

Dataset

This repository uses the UCR Time Series Archive 2018 datasets. To install the datasets, download the .zip file from here, and extract the contents into the "data/".

Code

The codes are divided into three parts: Shapelet Discovery, Dataset Ranking with Shapelet-based Similarity, and Running Experiments of Multi-source Transfer Learning.

Shapelet Discovery

We discover shapelets with matrix profile based approach (Yeh et al., 2016).

python generate_shapelet.py

The codes are modified from the following link

References
  • Yeh, Chin-Chia Michael, et al. "Matrix profile I: all pairs similarity joins for time series: a unifying view that includes motifs, discords and shapelets." 2016 IEEE 16th international conference on data mining (ICDM). Ieee, 2016.

Calculate Shapelet-based Similarity

This is to calculate our novel method of Shapelet-based Similarity for transferability estimation.

The script supports three different distance metrics:

Shapelet Matching Metric

python calculate_shapelet_distance.py --metric shapelet_matching --source_duplication

Minimum Shapelet Metric

python calculate_shapelet_distance.py --metric minimum

Average Shapelet Metric

python calculate_shapelet_distance.py --metric average

The results will be saved in the score/ directory as CSV files.

Multi-source Transfer Learning

This does multi-source tranfer learning with the rankings of shapelet-based similarity.

Using Shapelet Matching Metric: To use the shapelet matching metric (with source duplication):

python main.py -dn 10 --target experiment --metric shapelet_matching_mean_source_duplication_len15_nb10

Or without source duplication:

python main.py -dn 10 --target experiment --metric shapelet_matching_mean_len15_nb10

Using Minimum Shapelet Metric: The following line conducts multi-source transfer learning with 10 sources selected by Minimum Shapelet for all the 128 UCR Archive datasets.

python main.py -dn 10 --target experiment --metric shapelet_minimum_len15_nb10

Single Dataset Example: To run transfer learning on a single dataset (e.g., Coffee):

python main.py -dn 10 --target Coffee --metric shapelet_matching_mean_source_duplication_len15_nb10

Citation

The previous citation of this research is as below, it will be updated with journal publish:

@inproceedings{lee2024model,
  title={Model Selection with a Shapelet-Based Distance Measure for Multi-source Transfer Learning in Time Series Classification},
  author={Lee, Jiseok and Iwana, Brian Kenji},
  booktitle={International Conference on Pattern Recognition},
  pages={160--175},
  year={2024},
  organization={Springer}
}

Contact

jiseok.lee@human.ait.kyushu-u.ac.jp

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published