DAMO-DI-ML / KDD2023-DCdetector

185 stars 21 forks source link

DCdetector (KDD 2023 research track paper)

DCdetector: Dual Attention Contrastive Representation Learning for Time Series Anomaly Detection [Paper]

The most fundamental challenge for time series anomaly detection is to learn a representation map that enables effective discrimination of anomalies. Reconstruction-based methods still dominate, but the representation learning with anomalies might hurt the performance with its large abnormal loss. In this paper, we propose DCdetector, a multi-scale dual attention contrastive representation learning model.

Figure1
Figure 1. Architecture comparison of three approaches.
Figure2
Figure 2. The workflow of the DCdetector framework.

Main Result

We compare our model with 26 baselines based on various evaluation criteria. Extensive experiments show that DCdetector achieves the best or comparable performance on eight benchmark datasets compared to various state-of-the-art algorithms.

Figure1
Table 1. Overall results on real-world multivariate datasets.
image image
Table 2. Overall results on NIPS-TS datasets. Table 3. Overall results on univariate dataset.
Figure4
Table 4. Multi-metrics results on NIPS-TS datasets.

Code Description

There are ten files/folders in the source.

Get Start

  1. Install Python 3.6, PyTorch >= 1.4.0.
  2. Download data. You can obtain all benchmarks from Google Cloud. All the datasets are well pre-processed.
  3. Train and evaluate. We provide the experiment scripts of all benchmarks under the folder ./scripts. You can reproduce the experiment results as follows:
bash ./scripts/SMD.sh
bash ./scripts/MSL.sh
bash ./scripts/SMAP.sh
bash ./scripts/PSM.sh
bash ./scripts/SWAT.sh
bash ./scripts/NIPS_TS_Swan.sh
bash ./scripts/NIPS_TS_Water.sh
bash ./scripts/UCR.sh

Also, some scripts of ablation experiments.

bash ./scripts/Ablation_attention_head.sh
bash ./scripts/Ablation_encoder_layer.sh
bash ./scripts/Ablation_Multiscale.sh
bash ./scripts/Ablation_Window_Size.sh

Citation

If you find this repo useful, please cite our paper.

@inproceedings{yang2023dcdetector,
  title={DCdetector: Dual Attention Contrastive Representation Learning for Time Series Anomaly Detection},
  author={Yiyuan Yang and Chaoli Zhang and Tian Zhou and Qingsong Wen and Liang Sun},
  booktitle={Proc. 29th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (KDD 2023)},
  location = {Long Beach, CA},
  pages={3033–3045},
  year={2023}
}

Contact

If you have any question or want to use the code, please contact yiyuan.yang@cs.ox.ac.uk, chaoli.zcl@alibaba-inc.com,tian.zt@alibaba-inc.com,qingsong.wen@alibaba-inc.com.

Acknowledgement

We appreciate the following github repos a lot for their valuable code:

https://github.com/thuml/Anomaly-Transformer

https://github.com/ahstat/affiliation-metrics-py

https://github.com/TheDatumOrg/VUS