This repository supplements our paper "Pre-training Enhanced Transformer for multivariate time series anomaly detection" accepted in Information Fusion 2025. Follow the below steps to replicate each cell in the results table.
We use Python-3.8.8.
pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
pip install -r requirements.txtYou can download all the raw datasets at Google Drive, and unzip them to TEP/.
Take the SMD dataset as an example, other datasets are similar.
- Method 1:
Retrain the CANets model
python main.py --model CANets --dataset SMD --retrainThe trained CANets model will be saved to the checkpoints/CANets_SMD folder, take out the .pth file with the lowest loss, rename it to SMD_CANets.pth, and finally put it in CANets/SMD, and then execute the following command.
python main.py --model TEP --dataset SMD --retrain --fuse_knowledge- Method 2: (Official Recommendation)
For each dataset, the pre-trained CANets model has been put in the CANets folder in advance. You can directly execute the following command.
python main.py --model TEP --dataset SMD --retrain --fuse_knowledgeOur paper is available in the Proceedings of Information Fusion: https://www.sciencedirect.com/science/article/pii/S1566253525002441. If you find this repository useful for your work, please consider citing it as follows:
@article{wang2025pre,
title={Pre-training Enhanced Transformer for multivariate time series anomaly detection},
author={Wang, Chao and Shi, Haochen and Hu, Jie and Yang, Xin and Zhang, Junbo and Du, Shengdong and Li, Tianrui},
journal={Information Fusion},
pages={103171},
year={2025},
publisher={Elsevier}
}If it is helpful to you, please give a star to the project, thank you.
This project is licensed under the BSD 3-Clause License.
See LICENSE for details.

