Introduction
Contrastive learning has emerged as a dominant paradigm for training deep learning models, particularly in scenarios with limited labeled data. By teaching encoders to pull positive samples (different views of the same instance) together while pushing negative samples (different classes) apart, models learn robust feature representations. However, standard contrastive learning frameworks often treat all positive samples as equally informative. In the context of time series data—which is frequently characterized by temporal shifts, noise, and complex boundaries—this "one-size-fits-all" approach to positive pairs can be limiting.
This paper introduces Rank Supervised Contrastive Learning (RankSCL), a framework designed to incorporate fine-grained relative similarity into the contrastive pipeline. By ranking positive samples based on their proximity to an anchor relative to negative samples, RankSCL achieves state-of-the-art performance across extensive benchmarks.
Methodology
RankSCL improves upon traditional contrastive learning through three primary technical innovations:
1. Targeted Embedding Space Augmentation
Traditional data augmentation typically occurs in the raw input space. For time series, this can lead to "distributional shift," where augmented samples no longer represent realistic signals. RankSCL instead applies small-scale "jittering" directly to the embeddings. This approach enriches the feature space and enhances the model's ability to generalize without compromising the underlying semantics of the signal.
2. Valid Triplet Selection
The framework identifies "valid hard negatives"—negative samples that are positioned closer to the anchor than a specific positive sample. This ranking mechanism allows the model to identify which positive samples are struggling to remain near the anchor, providing a more nuanced view of the feature space's local topology.
3. Arctan-based Rank Loss Function
The core of RankSCL is a novel loss function utilizing the arctan function. This function assigns higher weights to "confident" positive pairs (those with few or no hard negatives) and lower weights to "noisy" or "unreliable" pairs. The bounded nature of the arctan function prevents outliers from exerting excessive influence on the gradient, effectively acting as a noise filter during the training process.
Experimental Evaluation
The authors evaluated RankSCL using the two primary "gold standard" benchmarks in the field:
- UCR Archive: Comprising 128 univariate time series datasets.
- UEA Archive: Comprising 30 multivariate time series datasets.
These datasets span a wide range of domains, including healthcare (EEG), energy monitoring, and human activity recognition, providing a comprehensive test of the framework's versatility.
Key Results
RankSCL demonstrated superior performance compared to established baselines such as TS2Vec, TimesNet, and InfoTS.
- Multivariate Performance: On the 30 UEA datasets, RankSCL outperformed the previous state-of-the-art (TS2Vec) by 2.0% in Accuracy and 3.5% in Recall.
- Univariate Consistency: On the 128 UCR datasets, the framework achieved the best average rank across all primary metrics, including Accuracy, Precision, F1-score, and Recall.
- Representation Quality: Qualitative analysis using t-SNE visualizations indicated that RankSCL produces tighter and more distinct clusters. Unlike previous methods that often leave "straggler" points between class boundaries, RankSCL creates clearer separation.
Discussion and Limitations
The fundamental insight of this research is that a positive sample's utility is inversely proportional to the number of negative samples that are closer to the anchor than it is. By prioritizing "pure" positives, the model learns more robust decision boundaries.
However, some limitations persist. The method's performance is somewhat dependent on the jittering scales ($\alpha_1, \alpha_2$), which may require domain-specific tuning. Additionally, the process of triplet mining and ranking introduces computational complexity, though the authors suggest this is offset by the increased informativeness of the samples. Future work may extend this ranking logic to other time series tasks, such as anomaly detection or forecasting.
Summary updated