TapNet: Multivariate Time Series Classification with Attentional Prototypical Network

Xuchao Zhang, Yifeng Gao, Jessica Lin, Chang-Tien Lu

Introduction: The Challenge of Multivariate Time Series

Multivariate Time Series Classification (MTSC) involves identifying patterns across multiple co-evolving sensors, such as accelerometers or ECG leads. This is a cornerstone of modern data mining, yet researchers often face a "Goldilocks" dilemma between traditional and deep learning approaches.

Comparison of MTSC methods against common data challenges.

Traditional methods like Shapelets or Bag-of-Patterns are robust with few labeled examples but struggle to scale with high dimensionality. Conversely, deep learning methods (CNNs, LSTMs) excel at feature extraction but are "data-hungry," requiring massive labeled datasets often unavailable in specialized fields like medicine. TapNet bridges this gap, offering the feature-learning power of deep learning with the robustness of distance-based methods for label-scarce scenarios.

Methods: The TapNet Architecture

TapNet integrates three novel components into a unified pipeline designed for high-quality feature embedding and classification.

The complete TapNet architecture, including Random Dimension Permutation, dual-pathway encoding, and the Attentional Prototypical Network.

1. Random Dimension Permutation (RDP)

To capture interactions between sensors without being overwhelmed by high dimensionality, TapNet randomly groups dimensions into subsets. This allows the model to learn local patterns and inter-sensor relationships more effectively.

2. Multivariate Time Series Encoding

The model employs a dual-pathway approach:

  • LSTM Pathway: Captures global temporal context.
  • CNN Pathway: Processes grouped dimensions using 1D-Convolutional Neural Networks. Crucially, parameters are shared across groups to keep the model lean and prevent overfitting.

3. Attentional Prototypical Network

Instead of a standard Softmax layer, TapNet learns a "prototype" for each class—a weighted average of training samples calculated via an attention mechanism. Classification is then determined by the Euclidean distance between a new sample's low-dimensional representation and these prototypes. A semi-supervised extension, Semi-TapNet, further refines these prototypes using unlabeled data.

Evaluation and Results

The model was evaluated on 18 datasets from the UEA Multivariate Time Series Archive, covering domains from human activity recognition to medical diagnostics.

Key Performance Metrics

  • Top Ranking: TapNet achieved an average rank of 1.15 across all datasets, significantly outperforming the next best competitor, WEASEL+MUSE (3.23).
  • Win/Tie Rate: The model won or tied on 12 out of 18 datasets.
  • Small Data Robustness: On the "StandWalkJump" dataset (only 12 training samples), TapNet achieved 40% accuracy, whereas the deep learning baseline MLSTM-FCN managed only 6.7%.
  • Semi-Supervised Gains: Utilizing unlabeled data in the "Handwriting" dataset improved accuracy from 35.6% to 38.8%.

Insights and Limitations

TapNet demonstrates that distance-based learning is a "small data" superpower. By framing classification as a distance-to-prototype problem, the model avoids learning complex decision boundaries from scratch. Parameter sharing serves as a powerful regularizer, making the model resilient to overfitting.

However, challenges remain. t-SNE visualizations reveal that some classes remain close in the embedding space, indicating difficulty with highly similar classes under limited data. Additionally, while TapNet handles high dimensionality better than dictionary-based methods, the computational cost of training deep networks is higher than simple distance-based methods like DTW-1NN on very small datasets. Future work may explore refined attention mechanisms or alternative distance metrics.

Summary updated

BibTeX
@inproceedings{zhang2020tapnet,
  author = {Xuchao Zhang and Yifeng Gao and Jessica Lin and Chang-Tien Lu},
  title = {{TapNet: Multivariate Time Series Classification with Attentional Prototypical Network}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2020},
  doi = {10.1609/aaai.v34i04.6165},
}
Figure