GithubHelp home page GithubHelp logo

recurrent-autoencoder's Introduction

Recurrent Neural Networks-based Autoencoders

A PyTorch implementation of LSTM-based Encoder-Decoder for Multi-sensor Anomaly Detection

Table of Contents:

Project Structure:

The project structure is based on the following Pytorch Project Template

├── agents
|  └── rnn_autoencoder.py # the main training agent for the recurrent NN-based AE
├── graphs
|  └── models
|  |  └── recurrent_autoencoder.py  # recurrent NN-based AE model definition
|  └── losses
|  |  └── MAELoss.py # contains the Mean Absolute Error (MAE) loss
|  |  └── MSELoss.py # contains the Mean Squared Error (MSE) loss
|  |  └── AUCLoss.py # under development (DO NOT USE!)
├── datasets  # contains all dataloaders for the project
|  └── ecg5000.py # dataloader for ECG5000 dataset
├── data
|  └── ECG5000  # contains all ECG time series
├── utils # utilities folder containing metrics, checkpoints and arg parsing (configs).
|  └── assets
|  └── checkpoints.py
|  └── config.py
|  └── metrics.py
|  └── create_config.py
|  └── data_preparation.py
├── notebooks # Folder where adding your notebook
├── experiments # Folder where saving the results of your experiments
├── main.py

Model

Encoder

alt text

In the encoder each vector of a time-window of length is fed into a recurrent unit to perform the following computation:

Decoder

alt text

In the decoder we reconstruct the time series in reverse order:

Data

Description

The ECG5000 dataset contains 5000 ElectroCardioGram (ECG) univariate time series of length . Each sequence corresponds to an heartbeat. Five classes are annotated, corresponding to the following labels: Normal (N), R-on-T Premature Ventricular Contraction (R-on-T PVC), Premature Ventricular Contraction (PVC), Supra-ventricular Premature or Ectopic Beat (SP or EB) and Unclassified Beat (UB). For each class we have the number of instances reported in the following Table:

Class #Instance
N 2919
R-on-T PVC 1767
PVC 194
SP or EB 96
UB 24

Since the main task here is anomaly detection rather than classification, all istances which do not belong to class N have been merged in unique class which will be referred to as Anomalous (AN).

Download and data partioning

You can directly download the ECG5000 dataset from here or by running the script utils/data_preparation.py. This script allows performing data partitioning as well, i.e., splitting your data in training, validation and test set. For more details, run the following: python utils/data_preparation.py -h

Requirements

Check requirements.txt.

Usage

  • Before running the project, you need to add your configuration into the folder configs/ as found here. To this aim, you can just modify the script utils/create_config.pyand then running the following python utils/create_config.py.
  • Finally to run the project: python main.py configs/config_rnn_ae.json

recurrent-autoencoder's People

Contributors

pylink88 avatar

Stargazers

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

Watchers

 avatar

recurrent-autoencoder's Issues

Dataset problem

The ECG5000 original dataset does not distinguish between the x and y data sets. How can I obtain these data sets x_val and y_val? Thank you!

Result

How to check the experimental results,thank you

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.