计算机科学 ›› 2026, Vol. 53 ›› Issue (8): 20-28.doi: 10.11896/jsjkx.250700100

• 数据库 & 大数据 & 数据科学 • 上一篇    下一篇

基于时频对比学习的时间序列异常检测

刘艳泽1,2, 韩波3, 原继东1,2, 苏东亮1,2, 任佳4, 蔡智明4, 王志海2   

  1. 1 交通大数据与人工智能教育部重点实验室 北京 100044
    2 北京交通大学计算机科学与技术学院 北京 100044
    3 龙盈智达(北京)科技有限公司 北京 100026
    4 澳门中西创新学院数字科技学院 澳门 999078
  • 收稿日期:2025-07-15 修回日期:2025-11-14 出版日期:2026-08-15 发布日期:2026-08-17
  • 通讯作者: 原继东(yuanjd@bjtu.edu.cn)
  • 作者简介:(23125245@bjtu.edu.cn)
  • 基金资助:
    中央高校基本科研业务费专项资金(2025JBZX059,2025JBMC028)

Anomaly Detection in Time Series Based on Time-Frequency Contrastive Learning

LIU Yanze1,2, HAN Bo3, YUAN Jidong1,2, SU Dongliang1,2, REN Jia4, CAI Zhiming4, WANG Zhihai 2   

  1. 1 Key Laboratory of Big Data & Artificial Intelligence in Transportation, Ministry of Education, Beijing 100044, China
    2 School of Computer Science and Technology, Beijing Jiaotong University, Beijing 100044, China
    3 Longying Zhida(Beijing) Technology Co., Ltd., Beijing 100026, China
    4 Faculty of Digital Science and Technology, Macau Millennium College, Macau 999078, China
  • Received:2025-07-15 Revised:2025-11-14 Published:2026-08-15 Online:2026-08-17
  • About author:LIU Yanze,born in 2002,postgraduate.His main research interests include artificial intelligence and time series ano-maly detection.
    YUAN Jidong,born in 1989,Ph.D,associate professor.His main research in-terests include data mining and pattern recognition.
  • Supported by:
    Fundamental Research Funds for the Central Universities(2025JBZX059,2025JBMC028).

摘要: 时间序列异常检测在金融、医疗以及工业生产等领域发挥着重要作用,相关应用包括金融领域银行核心系统异常响应码的检测、脑电信号的监测,以及工业传感器信号的预警等。在多维时间序列异常检测领域,现有方法在处理复杂模式及标签稀疏数据等方面存在局限。对此,提出了基于时频对比学习的自监督时间序列异常检测算法,创新性地融合时域和频域特征,构建了一种跨模态的表示学习框架。首先,通过时域和频域特征提取,从随机增强样本中获取高质量时频一致性表征;其次,基于时频排序对比损失与分层对比损失函数协同优化模型,精准把控不同样本间距离,捕捉时间序列多尺度信息并有效应对对比学习中的假阴性样本问题;最后,依据样本掩码与滑动窗口判定识别异常。在多个不同领域数据集上的实验结果表明,该算法达到当前最优水平,消融实验结果和可视化结果验证了所提算法和各模块的有效性,为金融和工业等领域时间序列异常检测提供了高效、精准且鲁棒的解决方案。

关键词: 时间序列, 异常检测, 时频对比学习, 多域特征提取

Abstract: Time series anomaly detection plays a crucial role in various fields such as finance,healthcare,and industrial production.Relevant applications include detecting abnormal response codes in core banking systems within the financial sector,monitoring electroencephalographic(EEG) signals in healthcare,and providing early warnings for industrial sensor signals.In the field of multivariate time series anomaly detection,existing methods have limitations in handling complex patterns and data with sparse labels.This paper proposes a self-supervised time series anomaly detection algorithm based on time-frequency contrastive learning,which innovatively combines time-domain and frequency-domain features to build a cross-modal representation learning framework.Firstly,high-quality time-frequency consistent representations are obtained from randomly augmented samples through time-domain and frequency-domain feature extraction.Secondly,the model is optimized using a time-frequency ranking contrastive loss function and a hierarchical contrastive loss function and,which accurately control the distance between different samples,capture multi-scale information in time series,and effectively address the issue of false negative samples in contrastive learning.Finally,anomalies are identified based on sample masking and sliding window detection.Experimental results on several datasets from different fields show that the algorithm achieves state-of-the-art performance.Ablation experiments and visualization results verify the effectiveness of the proposed algorithm and its modules,providing an efficient,accurate,and robust solution for time series anomaly detection in finance,industry,and other fields.

Key words: ime series, Anomaly detection, Time-frequency contrastive learning, Multi-domain feature extraction

中图分类号: 

  • TP391
[1] HAMILTON J D.Time series analysis[M].Princeton:Princeton university press,2020.
[2] HOCHENBAUM J,VALLIS O S,KEJARIWAL A.Automatic anomaly detection in the cloud via statistical learning[J].arXiv:1704.07706,2017.
[3] YANG M,WANG J.Adaptability of financial time series prediction based on BiLSTM[J].Procedia Computer Science,2022,199:18-25.
[4] WEN Q,YANG L,ZHOU T,et al.Robust time series analysis and applications:An industrial perspective[C]//Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining.2022:4836-4837.
[5] GUO Y,LIAO W,WANG Q,et al.Multidimensional time series anomaly detection:A gru-based gaussian mixture variational autoencoder approach[C]//Asian Conference on Machine Learning.PMLR,2018:97-112.
[6] PALAKURTI N R.Challenges and future directions in anomaly detection[M]//Practical Applications of Data Processing,Algorithms,and Modeling.IGI Global,2024:269-284.
[7] MEJRI N,LOPEZ-FUENTES L,ROY K,et al.Unsupervisedanomaly detection in time-series:An extensive evaluation and analysis of state-of-the-art methods[J].Expert Systems with Applications,2024,256:124922.
[8] TSAI Y H H,WU Y,SALAKHUTDINOV R,et al.Self-supervised learning from a multi-view perspective[J].arXiv:2006.05576,2020.
[9] XU K,QIN M,SUN F,et al.Learning in the frequency domain[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition.2020:1740-1749.
[10] ZHANG C,ZHOU T,WEN Q,et al.Tfad:A decompositiontime series anomaly detection architecture with time-frequency analysis[C]//Proceedings of the 31st ACM International Conference on Information & Knowledge Management.2022:2497-2507.
[11] ZHANG X,ZHAO Z,TSILIGKARIDIS T,et al.Self-supervised contrastive pre-training for time series via time-frequency consistency[C]//NeurIPS 2022.2022:3988-4003.
[12] CARTER K M,STREILEIN W W.Probabilistic reasoning for streaming anomaly detection[C]//2012 IEEE Statistical Signal Processing Workshop(SSP).IEEE,2012:377-380.
[13] REDDY A,ORDWAY-WEST M,LEE M,et al.Using gaussian mixture models to detect outliers in seasonal univariate network traffic[C]//2017 IEEE Security and Privacy Workshops(SPW).IEEE,2017:229-234.
[14] KOZITSIN V,KATSER I,LAKONTSEV D.Online forecasting and anomaly detection based on the ARIMA model[J].Applied Sciences,2021,11(7):3194.
[15] LI Z,ZHAO Y,LIU R,et al.Robust and rapid clustering of kpis for large-scale anomaly detection[C]//2018 IEEE/ACM 26th International Symposium on Quality of Service(IWQoS).IEEE,2018:1-10.
[16] SADR A V,BASSETT B A,KUNZ M.A flexible frameworkfor anomaly detection via dimensionality reduction[C]//2019 6th International Conference on Soft Computing & Machine Intelligence(ISCMI).IEEE,2019:106-110.
[17] BERAHMAND K,BAHADORI S,ABADEH M N,et al.Sdac-da:Semi-supervised deep attributed clustering using dual autoencoder[J].IEEE Transactions on Knowledge and Data Engineering,2024,36(11):6989-7002.
[18] AUDIBERT J,MICHIARDI P,GUYARD F,et al.Usad:Unsupervised anomaly detection on multivariate time series[C]//Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining.2020:3395-3404.
[19] ZHANG C,SONG D,CHEN Y,et al.A deep neural network for unsupervised anomaly detection and diagnosis in multivariate time series data[C]//Proceedings of the AAAI Conference on Artificial Intelligence.2019:1409-1416.
[20] CHEN S W,LI J,XUAN J X,et al.LSTM-GAN:Unsupervised Anomaly Detection for Time Series Fusion of GAN and Bi-LSTM[J].Journal of Chinese Computer Systems.2024,45(1):123-131.
[21] XU J.Anomaly transformer:Time series anomaly detection with association discrepancy[J].arXiv:2110.02642,2021.
[22] TULI S,CASALE G,JENNINGS N R.Tranad:Deep trans-former networks for anomaly detection in multivariate time series data[J].arXiv:2201.07284,2022.
[23] YUE Z,WANG Y,DUAN J,et al.Ts2vec:Towards universal representation of time series[C]//Proceedings of the AAAI Conference on Artificial Intelligence.2022:8980-8987.
[24] YANG Y,ZHANG C,ZHOU T,et al.Dcdetector:Dual attention contrastive representation learning for time series anomaly detection[C]//Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining.2023:3033-3045.
[25] WANG C,ZHUANG Z,QI Q,et al.Drift doesn’t matter:dynamic decomposition with diffusion reconstruction for unstable multivariate time series anomaly detection[C]//NeurIPS 2023.2024.
[26] JEONG Y,YANG E,RYU J H,et al.Anomalybert:Self-supervised transformer for time series anomaly detection using data degradation scheme[J].arXiv:2305.04468,2023.
[27] DENG A,HOOI B.Graph neural network-based anomaly detection in multivariate time series[C]//Proceedings of the AAAI Conference on Artificial Intelligence.2021:4027-4035.
[28] ZONG B,SONG Q,MIN M R,et al.Deep autoencoding gaussian mixture model for unsupervised anomaly detection[C]//International Conference on Learning Representations.2018.
[29] SHENTU Q,LI B,ZHAO K,et al.Towards ageneral time series anomaly detector with adaptive bottlenecks and dual adversarial decoders[J].arXiv:2405.15273,2024.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!