Series2vec: similarity-based self-supervised representation learning for time series classification

Navid Mohammadi Foumani, Chang Wei Tan, Geoffrey I. Webb, Hamid Rezatofighi, Mahsa Salehi

Abstract

Self-supervised learning (SSL) has revolutionized computer vision by leveraging data augmentations to learn robust representations. However, applying these techniques to time series data is problematic, as standard augmentations often destroy critical temporal patterns. We present Series2vec, a novel SSL framework that avoids hand-crafted augmentations by predicting the similarity between time series pairs. By training encoders to preserve temporal and spectral similarities, Series2vec achieves state-of-the-art performance across diverse benchmarks, particularly in low-label regimes.

Introduction

In Computer Vision, SSL typically involves contrasting different "views" of the same image (e.g., rotations or crops). This works because the semantic content remains invariant. For time series, however, the "cat is still a cat" logic often fails. Swapping segments in an EKG or adding jitter to a sensor reading can fundamentally change the underlying class, leading to poor feature representation. The challenge lies in learning meaningful features without relying on these risky, hand-crafted augmentations.

The Augmentation Trap

The authors demonstrate that standard augmentations can be counterproductive. As shown in the visualization below, augmented samples from one class can end up closer (in terms of Dynamic Time Warping distance) to samples from a different class than to their own original version. This "augmentation trap" explains why models borrowed from vision often underperform on time series tasks.

The Augmentation Trap: (a) Dendrogram showing augmented series clustering with incorrect classes. (b) Accuracy drop when training on augmented data.

The Series2vec Framework

Series2vec moves away from binary contrastive tasks. Instead, it focuses on similarity-based pretext tasks using the following components:

  1. Dual-Domain Encoders: The model processes data in two parallel branches: the Temporal Domain (raw time steps) and the Spectral Domain (frequency information via Fourier Transform).
  2. Similarity as a Target: Instead of a binary "same/different" task, the model calculates the actual similarity between pairs of series in the training batch. It uses Soft-DTW (a differentiable version of Dynamic Time Warping) for the time domain and Euclidean distance for the frequency domain.
  3. Order-Invariant Self-Attention: A Transformer block treats each time series in a batch as a "token," allowing the network to learn representations that preserve relative similarities across the entire batch.
  4. The Loss Function: The model uses a Smooth L1 loss to minimize the difference between the similarity of the raw data and the similarity of the learned representations.

Experimental Results

Series2vec was evaluated on a massive scale, including 9 large real-world datasets (e.g., WISDM, PAMAP2, Sleep, Epilepsy) and the 158-dataset UCR/UEA archive.

  • Superior Accuracy: Series2vec achieved an average accuracy of 82.47% across the nine large datasets, outperforming the previous leader, TS2Vec (79.90%), and other popular models like TS-TCC and TNC.
  • Low-Label Champion: In scenarios with very few labeled samples (e.g., fewer than 50 samples per class), Series2vec significantly outperformed fully supervised models, proving its efficiency for real-world applications where labeling is expensive.
  • Complementary Strengths: Fusing Series2vec with other self-supervised losses (like reconstruction or contrastive loss) further improved performance, suggesting that similarity-based learning captures unique structural information missing from other methods.

Conclusion

Series2vec demonstrates that similarity is a powerful, augmentation-free signal for self-supervised learning in time series. By focusing on the inherent relationships between samples rather than artificial transformations, it provides a more robust foundation for time series classification, especially when labeled data is scarce.

Summary updated

BibTeX
@article{foumani2024series,
  author = {Navid Mohammadi Foumani and Chang Wei Tan and Geoffrey I. Webb and Hamid Rezatofighi and Mahsa Salehi},
  title = {{Series2vec: similarity-based self-supervised representation learning for time series classification}},
  journal = {Data Min. Knowl. Discov.},
  year = {2024},
  doi = {10.1007/s10618-024-01043-w},
}
Figure