All Projects → chickenbestlover → Rnn Time Series Anomaly Detection

chickenbestlover / Rnn Time Series Anomaly Detection

Licence: apache-2.0
RNN based Time-series Anomaly detector model implemented in Pytorch.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Rnn Time Series Anomaly Detection

Ad examples
A collection of anomaly detection methods (iid/point-based, graph and time series) including active learning for anomaly detection/discovery, bayesian rule-mining, description for diversity/explanation/interpretability. Analysis of incorporating label feedback with ensemble and tree-based detectors. Includes adversarial attacks with Graph Convolutional Network.
Stars: ✭ 641 (-10.72%)
Mutual labels:  time-series, rnn, anomaly-detection
Btctrading
Time Series Forecast with Bitcoin value, to detect upward/down trends with Machine Learning Algorithms
Stars: ✭ 99 (-86.21%)
Mutual labels:  forecast, time-series, prediction
Sweep
Extending broom for time series forecasting
Stars: ✭ 143 (-80.08%)
Mutual labels:  forecast, time-series, prediction
Neural prophet
NeuralProphet - A simple forecasting model based on Neural Networks in PyTorch
Stars: ✭ 1,125 (+56.69%)
Mutual labels:  forecast, time-series, prediction
Telemanom
A framework for using LSTMs to detect anomalies in multivariate time series data. Includes spacecraft anomaly data and experiments from the Mars Science Laboratory and SMAP missions.
Stars: ✭ 589 (-17.97%)
Mutual labels:  time-series, rnn, anomaly-detection
MessyTimeSeries.jl
A Julia implementation of basic tools for time series analysis compatible with incomplete data.
Stars: ✭ 88 (-87.74%)
Mutual labels:  time-series, forecast
khiva-ruby
High-performance time series algorithms for Ruby
Stars: ✭ 27 (-96.24%)
Mutual labels:  time-series, anomaly-detection
chaos
Singular Spectrum Analysis methods implementation in Python
Stars: ✭ 22 (-96.94%)
Mutual labels:  prediction, forecast
Merlion
Merlion: A Machine Learning Framework for Time Series Intelligence
Stars: ✭ 2,368 (+229.81%)
Mutual labels:  time-series, anomaly-detection
Anomalize
Tidy anomaly detection
Stars: ✭ 263 (-63.37%)
Mutual labels:  time-series, anomaly-detection
Pycaret
An open-source, low-code machine learning library in Python
Stars: ✭ 4,594 (+539.83%)
Mutual labels:  time-series, anomaly-detection
mtad-gat-pytorch
PyTorch implementation of MTAD-GAT (Multivariate Time-Series Anomaly Detection via Graph Attention Networks) by Zhao et. al (2020, https://arxiv.org/abs/2009.02040).
Stars: ✭ 85 (-88.16%)
Mutual labels:  time-series, anomaly-detection
magi
📈 high level wrapper for parallel univariate time series forecasting 📉
Stars: ✭ 17 (-97.63%)
Mutual labels:  time-series, forecast
Adtk
A Python toolkit for rule-based/unsupervised anomaly detection in time series
Stars: ✭ 615 (-14.35%)
Mutual labels:  time-series, anomaly-detection
COVID19
Using Kalman Filter to Predict Corona Virus Spread
Stars: ✭ 78 (-89.14%)
Mutual labels:  time-series, prediction
foot
foot是一个集足球数据采集器,简单分析的项目.AI足球球探为程序全自动处理,全程无人为参与干预足球分析足球预测程序.程序根据各大指数多维度数据,结合作者多年足球分析经验,精雕细琢,集天地之灵气,汲日月之精华,历时七七四十九天,经Bug九九八十一个,编码而成.有兴趣的朋友,可以关注一下公众号AI球探(微信号ai00268).
Stars: ✭ 96 (-86.63%)
Mutual labels:  prediction, forecast
Timetk
A toolkit for working with time series in R
Stars: ✭ 371 (-48.33%)
Mutual labels:  forecast, time-series
Deepadots
Repository of the paper "A Systematic Evaluation of Deep Anomaly Detection Methods for Time Series".
Stars: ✭ 335 (-53.34%)
Mutual labels:  time-series, anomaly-detection
Wavetorch
🌊 Numerically solving and backpropagating through the wave equation
Stars: ✭ 387 (-46.1%)
Mutual labels:  time-series, rnn
gpu accelerated forecasting modeltime gluonts
GPU-Accelerated Deep Learning for Time Series using Modeltime GluonTS (Learning Lab 53). Event sponsors: Saturn Cloud, NVIDIA, & Business Science.
Stars: ✭ 20 (-97.21%)
Mutual labels:  time-series, forecast

RNN-Time-series-Anomaly-Detection

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

  • Ubuntu 16.04+ (Errors reported on Windows 10. see issue. Suggesstions are welcomed.)
  • Python 3.5+
  • Pytorch 0.4.0+
  • Numpy
  • Matplotlib
  • Scikit-learn

Dataset

1. NYC taxi passenger count

2. Electrocardiograms (ECGs)

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

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

RNN-based Multi-Step Prediction Model

0. Architecture

arch

When the value of x_i is known from i=0 to i=t, the model recursively predicts the value of x_i from i=t+1 to i=T. In this figure, t=3, T=8. We first train this model with a trainset which contains no anomalies, then we use the trained model to detect anomalies in a testset, where anomalies are included.

1. How to train this model

Recursive multi-step prediction using RNNs is a rather difficult problem. As the prediction progresses, the prediction errors are accumulated and the predictions rapidly become inaccurate. To solve this problem, we need a model that is robust to input noise.

1steploss

TODO

msteploss

TODO

pfloss

TODO

RNN-based Multi-Step Prediction Model

TODO

Example of usage

0. Download the dataset: Download the five kinds of multivariate time-series dataset (ecg, gesture,power_demand, respiration, space_shuttle), and Label all the abnormality points in the dataset.

    python 0_download_dataset.py

1. Time-series prediction: Train and save RNN based time-series prediction model on a single time-series trainset

    python 1_train_predictor.py --data ecg --filename chfdb_chf14_45590.pkl
    python 1_train_predictor.py --data nyc_taxi --filename nyc_taxi.pkl

Train multiple models using bash script

    ./1_train_predictor_all.sh

2. Anomaly detection: Fit multivariate gaussian distribution and calculate anomaly scores on a single time-series testset

    python 2_anomaly_detection.py --data ecg --filename chfdb_chf14_45590.pkl --prediction_window 10
    python 2_anomaly_detection.py --data nyc_taxi --filename nyc_taxi.pkl --prediction_window 10

Test multiple models using bash script

    ./2_anomaly_detection_all.sh

Result

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

prediction1

prediction2

2. Anomaly detection:

Anomaly scores from the Multivariate Gaussian Distribution model

equation1

  • NYC taxi passenger count

scores1

  • 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

Citations

Please consider citing this project in your publications if it helps your research. The following is a BibTeX reference. The BibTeX entry requires the url LaTeX package.

@misc{park2018anomaly,
author = {Park, Jinman},
title = {{RNN based Time-series Anomaly Detector Model Implemented in Pytorch}},
year = {2018},
howpublished = {\url{https://github.com/chickenbestlover/RNN-Time-series-Anomaly-Detection}},
note = {Accessed: [Insert date here]}
}

References

Contact

If you have any questions, please open an issue.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].