Git Product home page Git Product logo

adversarial-anomaly-detection-via-lstm's Introduction

Adversarial Anomaly Detection via LSTM

Introduction

Spatio-temporal event data are becoming increasingly available in a wide variety of applications, such as electronic transaction records, social network data, and crime data. How to efficiently detect anomalies in these dynamic systems using these streaming event data? We propose a novel anomaly detection framework for such event data combining the Long short-term memory (LSTM) and marked spatiotemporal point processes. The detection procedure can be computed in an online and distributed fashion via feeding the streaming data through an LSTM and a neural network-based discriminator. We study the false-alarm-rate and detection delay using theory and simulation and show that it can achieve weak signal detection by aggregating local statistics over time and networks. Finally, we demonstrate the good performance using real-world datasets.

The major contribution of this work is two-fold: (1) The work has obtained a robust anomaly detector based on a limited amount of training real data. It is proposed to generate ”realistic” fake samples using an adversarial framework to improve the discriminator; (2) The work has proposed modeling the event sequence data by integrating the versatile point process framework with LSTM. This gives the model better interpretability and flexibility in capturing the true underlying pattern.

Our framework is illustrated as follows:

Model structure

Adversarial learning framework

Demo

ppgan.py defines an adversarial model which consists of a discriminator and a generator. Both the discriminator and the generator are constructed by MSTPP_RNN object which is a LSTM based sequential data model defined in pprnn.py. A training demo is shown below:

from ppgan import PPGAN

with tf.Session() as sess:
    # load data (tensor) which contains multiple sequences
    # each sequence has arbitrary length, the tail of sequence is padded with 1 (for the time) and 0 (for other feature)
    data       = np.load("data/northcal.earthquake.perseason.npy")

    # model configurations
    lstm_hidden_size = 10
    # training configurations
    step_size  = np.shape(data)[1]
    batch_size = 5
    test_ratio = 0.3
    epoches    = 50
    lr         = 1e-2
    n_tgrid    = 50
    n_sgrid    = 50

    # define PPGAN
    ppgan = PPGAN(step_size, lstm_hidden_size, disc_layer_sizes=[20, 10])

    # train via gan
    ppgan.train(sess, batch_size, data, test_ratio, epoches, lr)

References

adversarial-anomaly-detection-via-lstm's People

Contributors

meowoodie avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

shouwangbuqi rcxd

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.