TimesURL: Self-Supervised Contrastive Learning for Universal Time Series Representation Learning

Jiexi Liu, Songcan Chen

Abstract

TimesURL is a novel self-supervised framework designed to learn universal representations for time series data. By introducing a frequency-temporal augmentation strategy and a unique "double Universum" hard-negative sampling technique, it captures both fine-grained local details and global instance-level patterns. TimesURL achieves state-of-the-art performance across six downstream applications, including forecasting, classification, and anomaly detection.

Introduction

Self-supervised contrastive learning (SSCL) has revolutionized representation learning in computer vision and natural language processing. However, applying these techniques to time series data presents unique challenges. First, standard augmentations like flipping or shuffling can destroy essential temporal properties such as trends and seasonality. Second, the "easy negative" problem—where random samples are too distinct from the anchor—results in a weak learning signal. Finally, there is a "granularity gap": tasks like forecasting require fine-grained segment-level information, while classification relies on global instance-level patterns. TimesURL addresses these hurdles to produce a single model capable of excelling across diverse temporal tasks.

Methodology

The TimesURL architecture integrates three core components to bridge the granularity gap and enhance the learning signal.

Overall architecture of TimesURL, showing the augmentation, encoding, and dual contrastive learning stages.

Frequency-Temporal Augmentation (FTAug)

To preserve temporal logic while introducing necessary variation, TimesURL employs FTAug. This strategy combines random cropping in the time domain with "frequency mixing" in the Fourier domain. By manipulating the frequency components, the model learns to be invariant to certain spectral shifts while maintaining the underlying seasonal and trend structures.

Dual Contrastive Learning (DualCon) with Double Universums

A key innovation of TimesURL is the "Double Universum" approach for hard-negative sampling. Universums are synthetic samples created by interpolating (mixing) the anchor sample with other samples in the embedding space. These synthetic negatives are mathematically closer to the anchor, forcing the model to learn more discriminative features.

The DualCon module utilizes instance and temporal Universums to provide a stronger learning signal through hard-negative sampling.

The DualCon module operates at two levels:

  1. Instance Universum: Focuses on global patterns to distinguish between different time series instances.
  2. Temporal Universum: Focuses on local patterns to distinguish between different segments within the same time series.

Joint Optimization

TimesURL employs a joint loss function that combines contrastive learning with a masked reconstruction task. While the contrastive loss captures relative relationships between segments and instances, the reconstruction loss ensures the model retains a deep understanding of the raw data's global structure. The backbone of the system is a Temporal Convolutional Network (TCN), optimized for capturing long-range dependencies.

Experimental Evaluation

The framework was evaluated across a wide range of benchmarks, including the UEA and UCR archives for classification, ETT datasets for forecasting and imputation, and the KPI and Yahoo datasets for anomaly detection.

Key Results

  • Classification: TimesURL achieved an average accuracy of 75.2% on UEA and 84.5% on UCR, outperforming previous leaders like InfoTS.
  • Forecasting: The model frequently surpassed specialized end-to-end architectures (e.g., Informer, LogTrans) in both short-term and long-term horizons.
  • Ablation Studies: Results confirmed the necessity of each component. Removing frequency mixing led to a 4.3% drop in accuracy, while omitting Double Universums resulted in a 3.6% decrease.

Conclusion

TimesURL demonstrates that a unified self-supervised approach can produce high-quality, universal representations for time series. By addressing the "easy negative" problem through synthetic Universums and preserving temporal semantics with FTAug, it sets a new standard for multi-task time series modeling. Future work may explore the integration of more advanced backbones and the potential for zero-shot application across domains.

Summary updated

BibTeX
@inproceedings{liu2024timesurl,
  author = {Jiexi Liu and Songcan Chen},
  title = {{TimesURL: Self-Supervised Contrastive Learning for Universal Time Series Representation Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i12.29299},
}
Figure