Code Monkey home page Code Monkey logo

gan-ad's Introduction

-- Multivariate Anomaly Detection for Time Series Data with GANs --

#GAN-AD

This repository contains code for the paper, Anomaly Detection with Generative Adversarial Networks for Multivariate Time Series, by Dan Li, Dacheng Chen, Jonathan Goh, and See-Kiong Ng.

Overview

We used generative adversarial networks (GANs) to do anomaly detection for time series data. The GAN framework was RGAN that taken from the paper, _Real-valued (Medical) Time Series Generation with Recurrent Conditional GANs. Please refer to https://github.com/ratschlab/RGAN for the original code.

Quickstart

  • Python3

  • Sample generation

    """python RGAN.py --settings_file gp_gen"""

    """python RGAN.py --settings_file sine_gen"""

    """python RGAN.py --settings_file mnistfull_gen"""

    """python RGAN.py --settings_file swat_gen"""

(Please unpack the mnist_train.7z file in the data folder before generate mnist)

  • To train the model for anomaly detection:

    """python RGAN.py --settings_file swat_train"""

  • To do anomaly detection:

    """python AD.py --settings_file swat_test"""

Data

In this repository, we applied GAN-AD on the SWaT dataset, please refer to https://itrust.sutd.edu.sg/ and send request to iTrust is you want to try the data.

gan-ad's People

Contributors

lidan456 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gan-ad's Issues

The figures are confusing me

Dear @LiDan456
I am so interested in your work on GAN-AD. However, i have some trouble to understand the figures created by running "phthon RGAN.py --settings_file swat_train" (see the attached images) . What do these curves represent? I try to find some key informations in the paper, but iam failed. Thanks for your generosity.

Best wishes
KB.
image
image

Cannot achieve results as reported in the paper

Dear @LiDan456 and all,

I have some problem with testing part and would like to ask for help.

After trying to run the model follows your instructions and code, I managed to train RGAN.py model with a SWAT data set (Pure normal physical data), which working great so far.

However, I have some problem with test in AD.py part. I am trying to test the model (GAN-AD with 5 PCA components) with the SWAT data set (Abnormal physical data) with your original code and default setting but I could not get the results close to reported performance in your paper. (The paper reported that GAN-AD with 5 PCA components can outperform other methods. The Accuracy is 94.80, Precision is 93.33, Recall is 63.64, F-1 is 0.75 and FPR is 0.46.) The result that I get is pretty poor and not as good as it should. (Please see the attached images)

GAN-AD_failed_result_crop

I also try training and testing again more than 10 times, but the best result I could achieve is Accuracy around 60-70% (which is far from the reported result)

As mention above, I would like to ask you questions as follows:

  1. Why I could not achieve the same result as reported in your paper? Do you have any suggestion about my mistake I might make in code or implementation processes or some setting might be missing?

  2. Did you do the cross-validation when you test? I am trying to read your paper and understand your code, but I still could not find any cross-validation method that you might implement. Please let me know if I misunderstood.

I would appreciate any comments, helps or suggestions. Thank you very much for your answer in advance.

GP() argument after ** must be a mapping

When i run the "RGAN.py",there's an error said
" samples, pdf = GP(**data_options, kernel='rbf')
TypeError: GP() argument after ** must be a mapping, not NoneType".

While if i run the "data_utils.py",process finished with no wrong.
So,i want to know how to deal with the issue.Thanks very much.

1

2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.