Deep Temporal Contrastive Clustering

Ying Zhong, Dong Huang, Chang-Dong Wang

Clustering time series data—grouping sequences like stock prices, heartbeats, or seismic waves without labels—is a notoriously difficult task. While deep learning has made strides in this area, most models focus solely on reconstructing the data or fitting it into clusters. A new paper titled "Deep Temporal Contrastive Clustering" (DTCC) introduces a more sophisticated approach: teaching models to recognize data by comparing different "views" of it.

TL;DR

DTCC is a novel framework that brings the power of contrastive learning to deep time series clustering. By simultaneously optimizing for data reconstruction, cluster distribution, and dual-level contrastive consistency (at both the instance and cluster levels), it achieves state-of-the-art performance across a wide variety of real-world datasets.

What Problem Does This Paper Address?

Traditional time series clustering often relies on hand-crafted distance metrics (like Dynamic Time Warping) that struggle with high-dimensional or noisy data. Recent deep learning methods use auto-encoders to learn better representations, but they typically have a "blind spot."

They focus on instance reconstruction (making sure the output looks like the input) or cluster distribution (making sure data points group together), but they fail to exploit contrastive information. In the world of self-supervised learning, contrastive info is the "secret sauce": it forces a model to recognize that a sample and its slightly distorted (augmented) version are the same thing, while two different samples are distinct. DTCC fills this gap by integrating these contrastive relationships directly into the clustering process.

Methods

The DTCC framework is built on four pillars that work together in a single, unified objective function:

  1. Parallel Views & Data Augmentation: For every input time series, the model creates an "augmented" version (using techniques like scaling or shifting). These two versions are fed into two identical temporal auto-encoders.
  2. Temporal Auto-encoders: The authors use bidirectional multi-layer dilated RNNs as encoders. This specific architecture is great at capturing temporal dynamics across different scales (short-term vs. long-term patterns).
  3. Cluster Distribution Learning: Instead of a standard "hard" k-means, they use a soft k-means objective via spectral relaxation. This allows the model to update cluster assignments ($Q$) using Singular Value Decomposition (SVD), which is more stable during training.
  4. Dual Contrastive Learning: This is the core innovation. The model minimizes two types of contrastive loss:
  5. Instance-level: Ensures the representation of an original sample is similar to its augmented counterpart.
  6. Cluster-level: Ensures that the overall cluster distribution of the original batch matches the distribution of the augmented batch.

Datasets

The researchers evaluated DTCC on ten real-world time series datasets from the well-known UCR Archive. These datasets cover diverse domains:

  • Medical: ECG200, ECGFiveDays
  • Biological: Beef, Meat
  • Sensor/Motion: MoteStrain, Plane, OSULeaf
  • Image-to-Series: dist.phal.outl.agegroup, Prox.phal.outl.ageGroup, Prox.phal.TW

Key Insights and Ideas

  • The "Dual" Advantage: Most contrastive models only look at instances. By adding a cluster-level contrastive loss, DTCC ensures that the high-level semantic structure of the data remains consistent, even when the raw data is perturbed.
  • Self-Supervision is Sufficient: The model doesn't need a single label to learn. By forcing the network to be "consistent" across different views and "discriminative" between different samples, it naturally discovers the underlying clusters.
  • Stability through SVD: Updating cluster indicators every few epochs using SVD (the Ky Fan theorem) prevents the "instability" often seen when trying to optimize cluster assignments and neural network weights at the same time.

Key Results

DTCC was compared against 12 other methods, including traditional k-means and state-of-the-art deep models like DTC and DTCR.

  • Superior Accuracy: DTCC achieved the highest Average Normalized Mutual Information (NMI) score of 0.4987, significantly outperforming the next best method (CRLI at 0.4395).
  • Consistency: In terms of the Rand Index (RI), DTCC was ranked in the top two for all ten datasets tested.
  • Ablation Success: The authors proved that removing either the instance-level or cluster-level contrastive loss led to a drop in performance, confirming that the "dual" approach is necessary for the best results.

Limitations and Future Work

While the paper demonstrates clear superiority, a few areas remain open for exploration:

  • Augmentation Sensitivity: The performance of contrastive learning often depends heavily on the type of data augmentation used. The paper uses a standard family of augmentations, but domain-specific ones might yield even better results.
  • Computational Complexity: Using bidirectional dilated RNNs and performing SVD every few epochs is computationally more intensive than simpler models. Scaling this to massive, streaming datasets could be a challenge.
  • Multivariate Extension: The current study focuses primarily on univariate time series; extending the dual contrastive framework to complex, multi-channel sensor data is a logical next step.

Summary updated

BibTeX
@inproceedings{zhong2023deep,
  author = {Ying Zhong and Dong Huang and Chang-Dong Wang},
  title = {{Deep Temporal Contrastive Clustering}},
  booktitle = {Neural Process. Lett},
  year = {2023},
  url = {https://openreview.net/forum?id=5Gek7lwW37},
}
Figure