Introduction
In real-world time series classification (TSC) tasks—such as monitoring brain signals for seizures or tracking physical activity—data typically consists of multiple classes with varying durations (MVD). Traditional TSC models often rely on the "independent and identically distributed" (i.i.d.) assumption, treating segments as isolated units. This approach fails to account for temporal dependencies and the inherent ambiguity at class boundaries, where human experts often disagree on exact transition points.
We present Con4m (Context-aware Consistency learning), a novel framework designed to leverage temporal context at both the data and label levels. By introducing a curriculum-based label harmonization strategy, Con4m effectively manages "fuzzy" boundaries and produces logically coherent predictions.
The Problem: Temporal Context and Label Inconsistency
Current TSC methodologies face two primary hurdles. First, they often ignore temporal context; for instance, if a subject is in a "seizure" state at time $t$, they are highly likely to remain in that state at $t+1$. Ignoring this leads to "jittery" predictions where labels flip-flop rapidly. Second, inconsistent boundary labels are common in expert-annotated datasets. As shown in Figure 1, different physicians may identify different start and end points for the same event, leading to noisy training data that confuses standard models.
Methodology
The Con4m framework addresses these challenges through three integrated components:
1. Continuous Contextual Representation Encoder
To ensure internal representations change smoothly, Con4m utilizes a Con-Attention mechanism. Unlike standard self-attention, this combines global attention with a Gaussian kernel prior, forcing the model to prioritize neighboring segments. This architectural choice ensures that the model captures local temporal dependencies effectively.
2. Context-aware Coherent Class Prediction
To prevent fragmented predictions, the framework employs two constraints:
- Neighbor Consistency: A discriminator learns to identify if adjacent segments belong to the same class, encouraging "concentrated" predictions.
- Prediction Behavior Constraint: The model fits a hyperbolic tangent (Tanh) function to its predictions. Since transitions in MVD data are typically monotonic, the Tanh function acts as a hard constraint to filter out illogical, high-frequency label flipping.
3. Label Consistency Training Framework
Con4m adopts a Curriculum Learning strategy to handle label noise. The model initially trains on "easy" core segments where expert agreement is high. As training progresses, it moves toward "hard" boundary segments, adaptively updating and "harmonizing" labels to resolve inconsistencies in the ground truth.
Experimental Evaluation
The framework was evaluated on four diverse MVD datasets: fNIRS (mental workload), HHAR (activity recognition), SleepEDF (sleep stages), and a private SEEG dataset (epileptic seizures).
Key Results
- Superior Accuracy: On the SEEG dataset, which contains significant real-world noise, Con4m achieved an F1 score of 72.00%, outperforming the next best model (Scale-T) by over 4%.
- Robustness to Noise: In controlled experiments with simulated boundary noise, Con4m's performance remained stable (dropping only ~2.37%), while baseline models saw performance degradations exceeding 13%.
- Qualitative Coherence: Case studies demonstrate that Con4m produces smooth, logical transitions that align with physical reality, whereas baseline models often produce fragmented, "choppy" outputs.
Conclusion
Con4m demonstrates that incorporating temporal context and addressing label inconsistency at boundaries are critical for robust time series classification. By moving beyond the i.i.d. assumption and employing mathematical smoothing via Tanh constraints and curriculum learning, Con4m provides a more reliable framework for analyzing complex, real-world physiological and sensor data.
Summary updated