Papers
Topics
Authors
Recent
Search
2000 character limit reached

TS-TCC: Temporal & Contextual Contrast in Time-Series

Updated 21 January 2026
  • The paper demonstrates that combining cross-view temporal prediction with global contextual discrimination yields robust and transferable time-series features, outperforming previous methods.
  • It details a dual-branch architecture using weak and strong augmentations to capture fine-grained temporal dynamics and preserve global context.
  • Empirical evaluations on HAR, Sleep-EDF, and Epilepsy datasets show improvements in accuracy and transferability, even in few-shot scenarios.

Time-Series Representation Learning via Temporal and Contextual Contrasting (TS-TCC) is a self-supervised framework for learning expressive features from unlabeled time-series data by combining cross-view temporal prediction and global contextual discrimination. TS-TCC is specifically tailored to temporal signals, addressing the limitations of prior contrastive paradigms developed for spatially-structured domains, such as images, by integrating both robust temporal modeling and context-aware contrastive objectives (Eldele et al., 2021, Eldele et al., 2022).

1. Conceptual Motivation and Framework Overview

The core motivation for TS-TCC lies in the challenge of extracting discriminative representations from unlabeled time-series, where complex temporal dependencies coexist with high labeling costs. While established contrastive learning methods (e.g., SimCLR, MoCo, CPC) succeed in spatial domains, they insufficiently preserve temporal structure when naively applied to sequence data, especially under standard augmentations.

TS-TCC introduces a dual-branch paradigm: each raw sequence is transformed into two correlated views via distinct augmentation pipelines (a “weak” and a “strong” view), designed to perturb amplitude, order, and fine-grained temporal relations. The self-supervised signal is established by two modules:

  • A temporal contrasting (TC) module that enforces cross-view future prediction to capture invariant, temporally aware features;
  • A contextual contrasting (CC) module that aligns global context vectors from different views of the same sequence while discriminating across sequences.

This structure yields a representation that is both temporally robust and contextually discriminative.

2. Time-Series-Specific Augmentation Strategies

TS-TCC employs augmentation techniques specifically devised for temporal signals, in contrast to the image-centric operations typical in prior contrastive SSL.

Weak augmentations (Tw\mathcal{T}_w) maintain global shape and primary dynamics:

  • Jitter: Additive small-variance Gaussian noise per channel, post min–max normalization (σ[0,0.1]\sigma \in [0, 0.1]).
  • Scaling: Multiply sequence by a global random factor sampled from [1/s,s][1/s, s] (typically s=2s=2).
  • Time-shift: (Extension in (Eldele et al., 2022)) Circularly shift the sequence by up to ±p%\pm p\%.

Strong augmentations (Ts\mathcal{T}_s) introduce substantial distortion:

  • Permutation: Segmentation of xx into MM contiguous parts (MM dataset-dependent; e.g., M=10M=10 for HAR, σ[0,0.1]\sigma \in [0, 0.1]0 for Sleep-EDF), followed by random reordering.
  • High-variance jitter: Additive Gaussian noise with σ[0,0.1]\sigma \in [0, 0.1]1.
  • Compositional perturbations: e.g., simultaneous permutation and strong jitter.

Each input σ[0,0.1]\sigma \in [0, 0.1]2 is transformed into: σ[0,0.1]\sigma \in [0, 0.1]3 These augmentations enable TS-TCC to capture invariance to amplitude changes and time order distortions while preserving temporal coherence.

3. Temporal Contrasting Module

The temporal contrasting module is designed to encourage representations that encode temporal dependencies robust to augmentation. The flow is as follows:

  • Both σ[0,0.1]\sigma \in [0, 0.1]4 and σ[0,0.1]\sigma \in [0, 0.1]5 are processed by a shared encoder σ[0,0.1]\sigma \in [0, 0.1]6 (a 3-block 1D CNN yielding per-timestep embeddings σ[0,0.1]\sigma \in [0, 0.1]7), optionally followed by an MLP.
  • Each sequence of embeddings is passed through an autoregressive Transformer σ[0,0.1]\sigma \in [0, 0.1]8 (4 layers, σ[0,0.1]\sigma \in [0, 0.1]9, 4 heads, pre-norm, dropout 0.1), prepending a learned “context token.”
  • At each time [1/s,s][1/s, s]0, the output [1/s,s][1/s, s]1 serves as a summary of [1/s,s][1/s, s]2.

Cross-View Future Prediction:

At a given time [1/s,s][1/s, s]3 and offset [1/s,s][1/s, s]4 ([1/s,s][1/s, s]5, with [1/s,s][1/s, s]6), the context vector from one view is used to predict the future latent of the other view. The prediction is parameterized by linear projections [1/s,s][1/s, s]7: [1/s,s][1/s, s]8 and vice versa. The prediction is optimized with an InfoNCE-style loss contrasting the pair [1/s,s][1/s, s]9 against negatives s=2s=20 from other sequences: s=2s=21 The total temporal contrasting loss is s=2s=22.

This enforces not only invariance to augmentation but also promotes modeling of sequence evolution across perturbations.

4. Contextual Contrasting Module

Following temporal contrasting, TS-TCC extracts global context vectors—usually the output of the “CLS” token of the Transformer at the final position—for each view. These vectors, s=2s=23 and s=2s=24, are further processed by an MLP projection head to produce context embeddings s=2s=25.

Given a batch of s=2s=26 sequences, the set of s=2s=27 context vectors is used in an instance-wise InfoNCE contrastive task. For each sequence, the two views (s=2s=28) form a positive pair (s=2s=29 indexes one view, ±p%\pm p\%0 the alternative view). All other vectors in the batch serve as negatives.

The contextual contrasting loss is: ±p%\pm p\%1

±p%\pm p\%2

This loss maximizes agreement between global summaries of the two views of each sample, thereby enhancing sample-level discrimination.

5. Joint Objective and Network Architecture

The complete TS-TCC loss is a weighted sum: ±p%\pm p\%3 Empirically, ±p%\pm p\%4, ±p%\pm p\%5 yield stable results.

Network architecture:

  • Encoder: 3-block 1D CNN (Conv–BatchNorm–ReLU–Dropout–MaxPool), ±p%\pm p\%6 per-timestep features.
  • Autoregressive head: 4-layer Transformer (±p%\pm p\%7 for most datasets).
  • Projection head: two-layer MLP for CC/SCC.
  • Optimization: Adam, lr=±p%\pm p\%8, weight decay=±p%\pm p\%9, Ts\mathcal{T}_s0, Ts\mathcal{T}_s1. Batch size: 128.
  • Augmentation settings: permutation segments Ts\mathcal{T}_s2 (UCI HAR), Ts\mathcal{T}_s3 (Epilepsy), Ts\mathcal{T}_s4 (Sleep-EDF); scale ratio=2; jitter Ts\mathcal{T}_s5 as above; temperature Ts\mathcal{T}_s6; Ts\mathcal{T}_s7 for future step range.

This modular design is broadly compatible with univariate and multivariate time-series and is dataset-agnostic aside from augmentation tuning.

6. Empirical Evaluation and Performance

TS-TCC was evaluated on multiple real-world datasets: UCI HAR (9-axis motion, 6 classes), Sleep-EDF EEG (single channel, 5 sleep stages), Epileptic Seizure Recognition (single channel, binary), as well as a fault diagnosis transfer setting and UCR benchmark datasets (Eldele et al., 2021, Eldele et al., 2022).

Linear evaluation (encoder frozen):

Dataset Random SSL-ECG CPC SimCLR TS-TCC Supervised
HAR (ACC) 57.9 65.3 83.8 81.0 90.4 90.1
Sleep (ACC) 35.6 74.6 82.8 78.9 83.0 83.4
Epilepsy (ACC) 90.3 93.7 96.6 96.1 97.2 96.7

Few-shot or semi-supervised fine-tuning:

  • With 1% labels, TS-TCC achieves Ts\mathcal{T}_s870% (HAR) and Ts\mathcal{T}_s990% (Epilepsy) MF1, significantly exceeding supervised (which drops below 50%).
  • With 10% labeled data, TS-TCC performance is within 2% of full-supervision on all datasets.

Transfer learning:

On the four-domain fault-diagnosis dataset (12 domain pairs):

  • Supervised pretrain + fine-tune: 63.8% accuracy
  • TS-TCC pretrain + fine-tune: 67.8% (+4.0% absolute gain)

This suggests that TS-TCC representations possess strong domain transferability even with minimal downstream labels.

7. Methodological Variants, Ablations, and Extensions

Ablation studies demonstrate:

  • TC only: Same-view prediction yields significantly lower accuracy (e.g., HAR ACC xx082.8%).
  • Adding cross-aug prediction: Both strongxx1weak and weakxx2strong future prediction improves accuracy (HAR xx387.9%).
  • Full TS-TCC (TC + CC): Further improvement (HAR xx490.4%). Single-augmentation variants show a sharp decline, especially on HAR and Sleep.

Sensitivity Analysis:

Using xx5 set to 40% of sequence length balances context diversity and temporal difficulty. Loss weights xx6, xx7 are robust to moderate perturbations.

Semi-supervised extension (CA-TCC) (Eldele et al., 2022):

With limited labels, CA-TCC leverages pseudo-labels after self-supervised pretraining. In place of the unsupervised contextual contrastive loss, it introduces a class-aware (supervised) contrastive loss:

  • For batch index xx8 and pseudo-labels xx9, positives are all other batch members with MM0, negatives are the rest.
  • Empirically, with 1% labels, CA-TCC attains 77.8% accuracy and 72.6% MF1 (10 datasets), besting baselines such as MeanTeacher or FixMatch.

Limitations:

Current TS-TCC evaluations are restricted to single-modality (univariate or multivariate) time-series. Augmentation strategies are fixed rather than learned or adaptive, and the autoregressive modeling capacity is limited to moderate-sized Transformers.

8. Conclusion and Significance

TS-TCC defines a general approach for self-supervised sequence representation learning tailored to time-series, exploiting both cross-view temporal prediction and global contextual contrasting. In benchmarks, it establishes or matches fully supervised performance, excels in few-shot and transfer settings, and serves as a foundation for extensible semi-supervised variants (CA-TCC). The empirical results underscore the efficacy of combining temporal and contextual signals via contrasting for robust, transferable time-series representations (Eldele et al., 2021, Eldele et al., 2022).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Time-Series Representation Learning via Temporal and Contextual Contrasting (TS-TCC).