Skip to content

This is an official pytorch implementation for paper "Learning Soft Sparse Shapes for Efficient Time-Series Classification" (ICML-25, Spotlight).

Notifications You must be signed in to change notification settings

ZLiu21/SoftShape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning Soft Sparse Shapes for Efficient Time-Series Classification

This is the training code for our paper Learning Soft Sparse Shapes for Efficient Time-Series Classification (ICML-25, Spotlight).

Abstract

Shapelets are discriminative subsequences (or shapes) with high interpretability in time series classification. Due to the time-intensive nature of shapelet discovery, existing shapelet-based methods mainly focus on selecting discriminative shapes while discarding others to achieve candidate subsequence sparsification. However, this approach may exclude beneficial shapes and overlook the varying contributions of shapelets to classification performance. To this end, we propose a Soft sparse Shapes (SoftShape) model for efficient time series classification. Our approach mainly introduces soft shape sparsification and soft shape learning blocks. The former transforms shapes into soft representations based on classification contribution scores, merging lower-scored ones into a single shape to retain and differentiate all subsequence information. The latter facilitates intra- and inter-shape temporal pattern learning, improving model efficiency by using sparsified soft shapes as inputs. Specifically, we employ a learnable router to activate a subset of class-specific expert networks for intra-shape pattern learning. Meanwhile, a shared expert network learns inter-shape patterns by converting sparsified soft shapes into sequences. Extensive experiments demonstrate that SoftShape outperforms state-of-the-art methods and produces interpretable results.

Datasets

We used 128 UCR time series datasets for time-series classification. The datasets utilized in this study can be downloaded at 128 UCR datasets.

Please refer to page 13 of the PDF document for the password to access the zipped file of the UCR archive.

Usage

To obtain a trained SoftShape model for time series classification, please run

python main_softshape.py --dataset [name of the UCR dataset you want to train]  ...

Note: Setting args.use_large_batch = 1 can significantly improve runtime efficiency without compromising the overall classification performance of SoftShape on the 128 time series datasets from the UCR archive.

For detailed options and examples, please refer to main_softshape.py.

Citation

If you use this code for your research, please cite our paper:

@inproceedings{liu2025softshape,
title={Learning soft sparse shapes for efficient time-series classification},
author={Zhen Liu and Yicheng Luo and Boyuan Li and Emadeldeen Eldele and Min Wu and Qianli Ma},
booktitle={International Conference on Machine Learning},
year={2025}
}

About

This is an official pytorch implementation for paper "Learning Soft Sparse Shapes for Efficient Time-Series Classification" (ICML-25, Spotlight).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published