[Paper Review] TS2Vec: Towards Universal Representation of Time Series
TS2Vec is a universal, hierarchical contrastive framework for time series that learns timestamp-level representations via augmented-context views, enabling accurate sub-series representations and state-of-the-art performance on classification, forecasting, and anomaly detection.
This paper presents TS2Vec, a universal framework for learning representations of time series in an arbitrary semantic level. Unlike existing methods, TS2Vec performs contrastive learning in a hierarchical way over augmented context views, which enables a robust contextual representation for each timestamp. Furthermore, to obtain the representation of an arbitrary sub-sequence in the time series, we can apply a simple aggregation over the representations of corresponding timestamps. We conduct extensive experiments on time series classification tasks to evaluate the quality of time series representations. As a result, TS2Vec achieves significant improvement over existing SOTAs of unsupervised time series representation on 125 UCR datasets and 29 UEA datasets. The learned timestamp-level representations also achieve superior results in time series forecasting and anomaly detection tasks. A linear regression trained on top of the learned representations outperforms previous SOTAs of time series forecasting. Furthermore, we present a simple way to apply the learned representations for unsupervised anomaly detection, which establishes SOTA results in the literature. The source code is publicly available at https://github.com/yuezhihan/ts2vec.
Motivation & Objective
- Motivate learning universal, fine-grained time-series representations beyond whole-sequence embeddings.
- Develop a hierarchical contrastive framework to capture multi-scale contextual information.
- Introduce contextual consistency for robust positive pair selection without strong inductive biases.
- Enable arbitrary-subseries representations via simple timestamp-level aggregation (max pooling).
- Demonstrate broad improvements across classification, forecasting, and anomaly detection tasks.
Proposed method
- Use two overlapping subseries from each input and enforce consistency of their shared segment representations.
- Encode inputs with an encoder consisting of input projection, timestamp masking, and a dilated CNN.
- Train with a dual contrastive loss: temporal contrastive loss and instance-wise contrastive loss (Eq. 1–3).
- Apply hierarchical contrast by max-pooling over time to create multi-scale representations and compute losses at multiple levels.
- Adopt contextual consistency for positive pairs via timestamp masking and random cropping to avoid distributional assumptions.
- Backbone supports multivariate inputs and uses dilated CNNs to achieve large receptive fields.
Experimental results
Research questions
- RQ1How can time series representations be learned at arbitrary semantic levels, not just full-sequence embeddings?
- RQ2Can hierarchical, multi-scale contrastive objectives improve robustness and generalization for time series tasks?
- RQ3Does contextual consistency provide better positive-pair selection than subseries or temporal consistency alone?
- RQ4Can the learned timestamp-level representations be aggregated to form effective sub-series embeddings for forecasting and anomaly detection?
Key findings
- TS2Vec achieves substantial improvements on time series classification, averaging 2.4% higher accuracy on 125 UCR datasets and 3.0% on 29 UEA datasets compared with the best unsupervised SOTA.
- The learned timestamp representations enable strong performance in forecasting with linear regression on top of representations, reducing MSE by up to 32.6% (univariate) and 28.2% (multivariate) on reported benchmarks.
- TS2Vec delivers state-of-the-art results in unsupervised anomaly detection in both normal and cold-start settings, with significant F1-score gains.
- Ablation shows removing components (temporal/instance/hierarchical contrast, contextual consistency, masking, etc.) degrades accuracy, confirming each component’s importance.
- Visualization confirms the model captures dynamics such as high/low timestamps, evolving trends, and seasonal patterns in learned representations.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.