zangzelin / code_USD

7 stars 1 forks source link

USD: Unsupervised Soft Contrastive Learning for Fault Detection in Multivariate Time Series

This repository provides a PyTorch implementation of USD, which combines data augmentation and soft contrastive learning to enhance the detection of anomalies in multivariate time series. This repository is based on MTGFlow.

Framework

Framework

Main results

Results

Requirements

torch==2.2.1
numpy==1.26.4
torchvision==0.17.1
scipy==1.11.3
scikit-learn==1.3.2
matplotlib==3.8.1
pillow==10.2.0
wandb==0.15.12
pandas==2.1.1
pip install -r requirements.txt

Data

We test our method for five public datasets, e.g., SWaT, WADI, PSM, MSL, and SMD.

SWaT WADI PSM MSL SMD

mkdir Dataset
cd Dataset
mkdir input

Download the dataset in Data/input. You can obtain the well pre-processed datasets from Google Drive

Run the code

For example, run the USD for the dataset of SWaT

python main.py --alpha=0.1 --batch_size=128 --k=10 --loss_weight_manifold_ne=5 --loss_weight_manifold_po=1 --lr=0.01 --n_blocks=1 --name=SWaT --seed=18 --train_split=0.6 --window_size=60

GANF and MTGFLOW

BibTex Citation

@misc{liu2024usd,
      title={USD: Unsupervised Soft Contrastive Learning for Fault Detection in Multivariate Time Series}, 
      author={Hong Liu and Xiuxiu Qiu and Yiming Shi and Zelin Zang},
      year={2024},
      eprint={2405.16258},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}