A time–frequency contrastive learning model for anomaly detection in multivariate time series
摘要
Anomaly detection in multivariate time series is critical for applications such as industrial maintenance, early warning systems, and environmental monitoring. However, existing reconstruction-based models often exhibit poor generalization and high false-negative rates, limiting their effectiveness. To address these challenges, this paper proposes a time–frequency contrastive learning (TFCL) anomaly detection model that integrates a contrastive learning module with a gated feature fusion module. The contrastive learning module employs a time-weighted and temperature-controlled loss function to enhance feature representation from both time and frequency perspectives. Meanwhile, the feature fusion module utilizes a gating mechanism to dynamically adjust the integration of time and frequency features, generating robust joint representations. Additionally, a latent-feature-driven and component-weighted anomaly discrimination strategy is proposed, leveraging reconstruction residuals and feature importance to precisely identify anomalies. The model’s performance was evaluated on publicly available datasets (SWaT and WADI) and real-world air quality monitoring data (AQMD). Experimental results demonstrate that TFCL achieves an average F1 score of 92.47% on SWaT and WADI, outperforming state-of-the-art methods and demonstrating good generalization. Moreover, the proposed TFCL achieves accurate anomaly detection in AQMD, which highlights its practical value in real-world scenarios.