计算机科学与探索 ›› 2024, Vol. 18 ›› Issue (3): 740-754.DOI: 10.3778/j.issn.1673-9418.2304005

• 人工智能·模式识别 • 上一篇    下一篇

融合双重注意力机制的时间序列异常检测模型

杨超城,严宣辉,陈容均,李汉章   

  1. 1. 福建师范大学 计算机与网络空间安全学院,福州 350117
    2. 福建师范大学 福建省环境监测物联网实验室,福州 350117
  • 出版日期:2024-03-01 发布日期:2024-03-01

Time Series Anomaly Detection Model with Dual Attention Mechanism

YANG Chaocheng, YAN Xuanhui, CHEN Rongjun, LI Hanzhang   

  1. 1. School of Computer and Cyberspace Security, Fujian Normal University, Fuzhou 350117, China
    2. Fujian Environmental Monitoring Internet of Things Laboratory, Fujian Normal University, Fuzhou 350117, China
  • Online:2024-03-01 Published:2024-03-01

摘要: 时间序列异常检测作为时间序列研究的重要组成部分,已经引起学术界和工业界的广泛关注和研究。针对时间序列数据中蕴含的深层局部特征和复杂的前后依赖关系,提出一种融合双重注意力机制的异常检测模型。该模型采用自编码器结构,由挤压激励注意力模块(SEAB)和概率稀疏自注意力模块(PSAB)组成编码器。SEAB通过利用动态加权窗口划分,为具有强可辨识性的子序列片段赋予更大的权重,使模型能够更加有效地挖掘出具有重要信息的局部特征。PSAB则采用稀疏自注意力机制,保留具有较高权重的点积,去除冗余的时序特征,降低了时间复杂度,从而捕获时间序列的长期依赖关系。实验结果表明,该模型在9个对比模型中取得了最高的[F1]分数0.97,并在14个测试数据集中有8个[F1]分数超过其他所有对比模型,因此可有效地识别时间序列数据中的异常情况,并具备先进的异常检测性能。

关键词: 时间序列, 异常检测, 深度学习, 注意力, 自编码器

Abstract: As an important part of time series research, time series anomaly detection has attracted extensive attention and research in academia and industry. In view of the deep local features and complex dependency in time series data, an anomaly detection model with dual attention mechanism is proposed. The model adopts autoencoder structure. The encoder is composed of a squeeze excitation attention block (SEAB) and a probsparse self-attention block (PSAB). SEAB mines local features containing important information by assigning greater weights to sequence segments with strong discriminability using dynamic weighted window partitioning. PSAB adopts sparse self-attention mechanism to retain dot products with higher weights, eliminate redundant timing features, and reduce time complexity, so as to capture the long-term dependence of time series. Experimental results show that the proposed model achieves the highest F1 score of 0.97 among 9 comparison models and outperforms all other comparison models in 8 of 14 tested datasets in terms of F1 score, which can effectively identify abnormal situation in time series data and achieve advanced anomaly detection performance.

Key words: time series, anomaly detection, deep learning, attention, autoencoder