Skip to content

immanuvelprathap/Electrocardiogram-Anomaly-Detection-RNN-Time-Series

Repository files navigation

Electrocardiogram-Anomaly-Detection-RNN-Time-Series

RNN based Time-series Anomaly detector model implemented in Pytorch.

This is an implementation of RNN based time-series anomaly detector, which consists of two-stage strategy of time-series prediction and anomaly score calculation.

Requirements

  • Python 3.5+
  • Pytorch 0.4.0+
  • Numpy
  • Matplotlib
  • Scikit-learn

Dataset you can implement on!

1. NYC taxi passenger count

2. Electrocardiograms (ECGs)

  • The ECG dataset containing a single anomaly corresponding to a pre-ventricular contraction "ECG_Dataset"

3. 2D gesture (video surveilance)

  • X Y coordinate of hand gesture in a video

4. Respiration

  • A patients respiration (measured by thorax extension, sampling rate 10Hz)

5. Space shuttle

  • Space Shuttle Marotta Valve time-series

6. Power demand

  • One years power demand at a Dutch research facility

The Time-series 2~6 are provided by E. Keogh et al. in "HOT SAX: Efficiently Finding the Most Unusual Time Series Subsequence." In The Fifth IEEE International Conference on Data Mining. (2005) , dataset

Result for ECG Dataset

1. Time-series prediction: Predictions from the stacked RNN model

prediction2

2. Anomaly detection:

Anomaly scores from the Multivariate Gaussian Distribution model

  • Electrocardiograms (ECGs) (filename: chfdb_chf14_45590)

scores3

scores4

Evaluation

Model performance was evaluated by comparing the model output with the pre-labeled ground-truth. Note that the labels are only used for model evaluation. The anomaly score threshold was increased from 0 to some maximum value to plot the change of precision, recall, and f1 score. Here we show only the results for the ECG dataset. Execute the code yourself and see more results.

1. Precision, recall, and F1 score:

  • Electrocardiograms (ECGs) (filename: chfdb_chf14_45590)

a. channel 0

f1ecg1

b. channel 1

f1ecg2

Technologies Used

Team

[Immanuvel Prathap's Website - Click Here!]

License

Open Source Project

Credits

References for researcher