Skip to content

decisionintelligence/ContraAD

Repository files navigation

ContraAD

This is the official code "Noise Matters: Cross Contrastive Learning for Flink Anomaly Detection"

Overview

overview

Key Contribution

  1. We use a cross contrastive method to detect the anomaly.
  2. We use a prior information to alleviate the noise inside training dataset

code structure

|-- data_factory
|   -- data_loader.py
|-- main.py
|-- model
|   |-- PointAttention.py # model file
|   |-- RevIN.py 
|   |-- attend.py 
|-- readme.md
|-- requirements.txt
|-- scripts
|   |-- ....sh # scripts 
|-- solver.py
`-- utils
    |-- logger.py
    -- utils.py

Setup


The code is well-tested on python>=3.10

This code base using accelerate for multi GPU training, please setup your local accelerate env following the instruction.

After that,

  1. download the dataset from google drive and rename the folder to dataset

  2. pip install -r requirements.txt

  3. train and evaluate using the script under the scripts (Due to differences in GPUs number, machines, parameters, etc., there may be slight variations in the experimental results.) folder.

    # e.g., 
    # train
    accelerate launch main.py --anormly_ratio 1 --num_epochs 3    --batch_size 256  --mode train --dataset PSM  --data_path PSM --input_c 25    --output_c 25  --loss_fuc MSE  --win_size 35 
    # test
    accelerate launch main.py --anormly_ratio 1 --num_epochs 3    --batch_size 256  --mode test --dataset PSM  --data_path PSM --input_c 25    --output_c 25  --loss_fuc MSE  --win_size 35

Result

overview

Citation

If you find the code useful, please cite our paper.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published