This is the implementation of SimAD: A Simple Dissimilarity-based Approach for Time Series Anomaly Detection
The paper has been accepted by TNNLS 2025 and appear in early access. For now, the latest preprint (v2) is available on arXiv. We added further experiments and analyses. Thank you for your interest!
If you have any questions, please feel free to contact me or raise an Issue.
Despite the prevalence of reconstruction-based deep learning methods, time series anomaly detection remains a tremendous challenge. Existing approaches often struggle with limited temporal contexts, insufficient representation of normal patterns, and flawed evaluation metrics, all of which hinder their effectiveness in detecting anomalous behavior. To address these issues, we introduce a Simple dissimilarity-based approach for time series Anomaly Detection, referred to as SimAD. Specifically, SimAD first incorporates a patching-based feature extractor capable of processing extended temporal windows and employs the EmbedPatch encoder to fully integrate normal behavioral patterns. Second, we design an innovative ContrastFusion module in SimAD, which strengthens the robustness of anomaly detection by highlighting the distributional differences between normal and abnormal data. Third, we introduce two robust enhanced evaluation metrics, Unbiased Affiliation (UAff) and Normalized Affiliation (NAff), designed to overcome the limitations of existing metrics by providing better distinctiveness and semantic clarity. The reliability of these two metrics has been demonstrated by both theoretical and experimental analyses. Experiments conducted on seven diverse time series datasets clearly demonstrate SimAD's superior performance compared to state-of-the-art methods, achieving relative improvements of 19.85% on F1, 4.44% on Aff-F1, 77.79% on NAff-F1, and 9.69% on AUC on six multivariate datasets. Code and pre-trained models are available at https://github.com/EmorZz1G/SimAD.
https://drive.google.com/drive/folders/1dDH3JRivRYEU02riHzGFUu74OxiwDax6?usp=sharing 1
You can download all datasets here. (Thanks for DCdetector repo and its authors.)
You can refer to requirements.txt to install all the packages.
pip install -r requirements.txt
- You should download the datasets into ABSOLUTE/PATH/OF/DATASET.
- The dataset structure should be like 'dataset_struct.txt'
- Run the scripts below.
- Note that the most important is you should change the parameter of --data_pth.
- We use --save_pth and --logs_pth for model and result saving.
- --resume controls whether to reload the trained model.
python main.py --data_name MSL --win_size 25600 --lr 0.0001 --gpu -1 --resume 0 --index 1 --batch_size 32 --step 1 --use_amp 0 --warmup_steps 20000 --warmup_max_ratio 0.2 --data_pth ABSOLUTE/PATH/OF/DATASET
python main.py --data_name MSL --win_size 25600 --lr 0.0001 --gpu -1 --resume 1 --index 1 --batch_size 32 --step 1 --use_amp 0 --warmup_steps 20000 --warmup_max_ratio 0.2 --data_pth ABSOLUTE/PATH/OF/DATASET
If you find this repo useful, please cite our paper or leave a star. It's very important to me. Thank you for your support
TNNLS version
@ARTICLE{zhong2025simad,
author={Zhong, Zhijie and Yu, Zhiwen and Xi, Xing and Xu, Yue and Cao, Wenming and Yang, Yiyuan and Yang, Kaixiang and You, Jane},
journal={IEEE Transactions on Neural Networks and Learning Systems},
title={SimAD: A Simple Dissimilarity-Based Approach for Time-Series Anomaly Detection},
year={2025},
volume={},
number={},
pages={1-12},
doi={10.1109/TNNLS.2025.3590220}}
or
preprint version
@misc{zhong2025simad,
title={SimAD: A Simple Dissimilarity-based Approach for Time Series Anomaly Detection},
author={Zhijie Zhong and Zhiwen Yu and Xing Xi and Yue Xu and Wenming Cao and Yiyuan Yang and Kaixiang Yang and Jane You},
year={2025},
eprint={2405.11238},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2405.11238},
}
We appreciate the following github repos a lot for their valuable code:
https://github.com/TheDatumOrg/VUS
https://github.com/ahstat/affiliation-metrics-py
- add docs.
- add website.
- enhance our code's readability.
Footnotes
-
The model trained on MSL dataset is too large. We are willing to upload it in the future. ↩

