Contrast All the Time: Learning Time Series Representation from Temporal Consistency
About
Representation learning for time series using contrastive learning has emerged as a critical technique for improving the performance of downstream tasks. To advance this effective approach, we introduce CaTT (\textit{Contrast All The Time}), a new approach to unsupervised contrastive learning for time series, which takes advantage of dynamics between temporally similar moments more efficiently and effectively than existing methods. CaTT departs from conventional time-series contrastive approaches that rely on data augmentations or selected views. Instead, it uses the full temporal dimension by contrasting all time steps in parallel. This is made possible by a scalable NT-pair formulation, which extends the classic N-pair loss across both batch and temporal dimensions, making the learning process end-to-end and more efficient. CaTT learns directly from the natural structure of temporal data, using repeated or adjacent time steps as implicit supervision, without the need for pair selection heuristics. We demonstrate that this approach produces superior embeddings which allow better performance in downstream tasks. Additionally, training is faster than other contrastive learning approaches, making it suitable for large-scale and real-world time series applications. The source code is publicly available at \href{https://github.com/sfi-norwai/CaTT}{https://github.com/sfi-norwai/CaTT}.
Related benchmarks
| Task | Dataset | Result | Rank | |
|---|---|---|---|---|
| Time-series classification | PAMAP2 | Accuracy69.86 | 40 | |
| Time-series classification | Harth | Accuracy93.13 | 30 | |
| Time-series classification | sleep | Accuracy85.17 | 30 | |
| Time-series classification | WISDM 2 | Accuracy63.25 | 30 | |
| Time-series classification | SKODA | Accuracy94.87 | 30 | |
| Time-series classification | ECG | Accuracy80.89 | 15 | |
| Time-series classification | Six large-scale datasets Aggregate | Average Accuracy81.2 | 15 | |
| Time-series classification | 124 UCR Datasets | Average Accuracy77.42 | 12 | |
| Time-series classification | 28 UEA Datasets | Average Accuracy69.17 | 12 | |
| Unsupervised Clustering | six large-scale datasets | NMI0.408 | 12 |