Page 321 - 《软件学报》2026年第2期
P. 321
800 软件学报 2026 年第 37 卷第 2 期
achieving higher detection accuracy. Existing studies typically address this problem using time series classification (TSC) techniques,
training a classifier on data from historical tasks, where the input is a time series, and the output is the predicted most accurate anomaly
detection algorithm for that time series. Although TSC-based solutions improve detection accuracy, existing standard TSC algorithms fail
to fully utilize the knowledge from historical anomaly detection tasks. This study proposes a knowledge-enhanced time series anomaly
detection framework. Specifically, in addition to training the TSC model with hard labels that represent the best detection algorithm for
each historical time series, the accuracy of all candidate algorithms evaluated on historical data is used to estimate the class distribution of
the input time series. The distribution is treated as a soft label, providing the algorithm selector (i.e., the TSC model) with more
knowledge about the relationships between the anomaly detection algorithms. Meanwhile, a module is designed to flexibly integrate various
types of external knowledge (e.g., descriptions of the domain, characteristics of time series, and anomalies) into the TSC model. The
proposed method is designed as a plugin that can be seamlessly integrated into any TSC model to enhance its performance in anomaly
detection algorithm selection, regardless of the model architecture. Extensive experiments on various types of time series datasets validate
the effectiveness of this approach.
Key words: time series anomaly detection; automatic algorithm selection; time-series data analysis; knowledge-enhanced system; artificial
intelligence for database
时间序列异常检测 [1] 技术是诸多实际应用中的重要支撑技术. 例如在云原生数据库系统监控运维中 [2] , 通过
时间序列异常检测算法对持续采集的时间序列数据, 如 CPU、内存和磁盘等资源的利用率、数据库调用情况等
监控指标进行分析, 检测其中的异常值, 能帮助运维人员及早地发现复杂庞大的云原生数据库系统中可能存在的
故障, 降低系统故障造成的损失并节约宝贵的人力和时间成本.
尽管近年来已有众多先进的时间序列异常检测算法被相继提出 [1,3] , 但大量研究表明, 由于时间序列数据特征
的异构性和异常类型的多样性, 在检测准确率方面, 当前各类时间序列异常检测算法在不同应用场景 (如监控指标
或业务负载) 上各有所长, 尚无通用的最佳方法 [1,3,4] . 为保证不同应用场景上的检测效果, 一种直接的解决方案是
通过集成学习 [5] 组合多种异常检测算法. 然而, 一方面, 此类方法每次检测时都需要运行多个算法, 计算代价较高.
另一方面, 现有研究表明 [4] , 多种时间序列异常检测算法的集成模型所能达到的检测准确率, 通常低于单独运行各
个算法所能达到的最佳水平. 因此, 实践中亟需针对不同场景的数据特点, 选择最佳时间序列异常检测算法, 从而
实现最优检测准确率.
由于不同业务中时间序列数据特点复杂多样 [6] , 为每类数据人工选择最佳异常检测算法不仅耗时耗力, 且需
要工作人员具备丰富的数据分析经验, 难以满足实际应用的需求. 为此, 研究人员提出了时间序列异常检测算法的
自动选择方法 [4,7,8] . 其主流思想是基于元学习 [9] , 利用候选的异常检测算法在历史时间序列数据上的检测准确率离
线构建时间序列分类 [10] 模型. 模型将输入时间序列映射为对应的类别, 即候选异常检测算法中具有最高检测准确
率的算法. 分类模型能够根据新生成时间序列的特征在线预测最佳异常检测算法 [4] , 从而最大程度减少人工干预,
提升效率并降低成本.
尽管当前的时间序列异常检测算法自动选择方法能有效弥补单一异常检测算法难以应对不同场景的不足, 但
现有方法存在一个严重缺陷, 即仅利用标准的时间序列分类技术 [11,12] 来构建算法预测模型, 缺乏对于时间序列异
常检测相关知识的充分利用. 主要体现在两方面. 第一, 现有方法在训练面向异常检测的时间序列分类模型时, 对
历史时间序列采用硬标签标注, 即将每个时间序列的类别标记为具有最高准确率的异常检测算法 [4] . 这种标记方
式忽略了除标记类别而外的其他异常检测算法在历史时间序列上的检测准确率信息, 使得模型难以充分学习有关
各异常检测算法间关联性的知识 [13] . 第二, 标准的时间序列分类方法仅能对原始时间序列和标注 (即异常检测算
法的准确率) 进行学习, 无法有效利用时间序列异常检测任务相关的外部知识, 如应用领域、数据特征和异常情况
的描述等. 上述缺陷造成现有方法选择最佳异常检测算法的能力有限, 异常检测的准确率不高.
针对上述问题, 本文提出了一种知识增强的时间序列异常检测算法自动选择方法, 充分利用时间序列异常检
测有关的知识, 提升异常检测算法的选择能力, 从而提高异常检测的准确率. 本文的主要贡献包括以下内容.
(1) 基于候选的时间序列异常检测算法在历史时间序列上的准确率, 估计时间序列的类别分布, 以此作为软标签,
设计软标签分类损失函数来指导时间序列分类模型的训练, 从而使模型学习更多有关异常检测算法间关联的知识.

