All Projects → HamishWoodrow → Anomaly_detection

HamishWoodrow / Anomaly_detection

This is a times series anomaly detection algorithm, implemented in Python, for catching multiple anomalies. It uses a moving average with an extreme student deviate (ESD) test to detect anomalous points.

Projects that are alternatives of or similar to Anomaly detection

Deepadots
Repository of the paper "A Systematic Evaluation of Deep Anomaly Detection Methods for Time Series".
Stars: ✭ 335 (+570%)
Mutual labels:  timeseries, anomaly-detection
Deep Learning For Hackers
Machine Learning tutorials with TensorFlow 2 and Keras in Python (Jupyter notebooks included) - (LSTMs, Hyperameter tuning, Data preprocessing, Bias-variance tradeoff, Anomaly Detection, Autoencoders, Time Series Forecasting, Object Detection, Sentiment Analysis, Intent Recognition with BERT)
Stars: ✭ 586 (+1072%)
Mutual labels:  jupyter-notebook, anomaly-detection
Credit Card Fraud Detection Using Autoencoders In Keras
iPython notebook and pre-trained model that shows how to build deep Autoencoder in Keras for Anomaly Detection in credit card transactions data
Stars: ✭ 337 (+574%)
Mutual labels:  jupyter-notebook, anomaly-detection
Hastic Server
Hastic data management server for analyzing patterns and anomalies from Grafana
Stars: ✭ 292 (+484%)
Mutual labels:  timeseries, anomaly-detection
Getting Things Done With Pytorch
Jupyter Notebook tutorials on solving real-world problems with Machine Learning & Deep Learning using PyTorch. Topics: Face detection with Detectron 2, Time Series anomaly detection with LSTM Autoencoders, Object Detection with YOLO v5, Build your first Neural Network, Time Series forecasting for Coronavirus daily cases, Sentiment Analysis with BERT.
Stars: ✭ 738 (+1376%)
Mutual labels:  jupyter-notebook, anomaly-detection
Pycaret
An open-source, low-code machine learning library in Python
Stars: ✭ 4,594 (+9088%)
Mutual labels:  jupyter-notebook, anomaly-detection
Dsp Theory
Theory of digital signal processing (DSP): signals, filtration (IIR, FIR, CIC, MAF), transforms (FFT, DFT, Hilbert, Z-transform) etc.
Stars: ✭ 437 (+774%)
Mutual labels:  jupyter-notebook, convolution
Timeseries fastai
fastai V2 implementation of Timeseries classification papers.
Stars: ✭ 221 (+342%)
Mutual labels:  jupyter-notebook, timeseries
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 (+1182%)
Mutual labels:  timeseries, anomaly-detection
K Nearest Neighbors With Dynamic Time Warping
Python implementation of KNN and DTW classification algorithm
Stars: ✭ 604 (+1108%)
Mutual labels:  jupyter-notebook, timeseries
2018 Machinelearning Lectures Esa
Machine Learning Lectures at the European Space Agency (ESA) in 2018
Stars: ✭ 280 (+460%)
Mutual labels:  jupyter-notebook, anomaly-detection
Kaggle Web Traffic Time Series Forecasting
Solution to Kaggle - Web Traffic Time Series Forecasting
Stars: ✭ 29 (-42%)
Mutual labels:  jupyter-notebook, timeseries
Transformer
Implementation of Transformer model (originally from Attention is All You Need) applied to Time Series.
Stars: ✭ 273 (+446%)
Mutual labels:  jupyter-notebook, timeseries
Skyline
Anomaly detection
Stars: ✭ 303 (+506%)
Mutual labels:  timeseries, anomaly-detection
sherlock
Sherlock is an anomaly detection service built on top of Druid
Stars: ✭ 137 (+174%)
Mutual labels:  timeseries, anomaly-detection
Tsai
Time series Timeseries Deep Learning Pytorch fastai - State-of-the-art Deep Learning with Time Series and Sequences in Pytorch / fastai
Stars: ✭ 407 (+714%)
Mutual labels:  jupyter-notebook, timeseries
Lstm anomaly thesis
Anomaly detection for temporal data using LSTMs
Stars: ✭ 178 (+256%)
Mutual labels:  jupyter-notebook, anomaly-detection
Tcdf
Temporal Causal Discovery Framework (PyTorch): discovering causal relationships between time series
Stars: ✭ 217 (+334%)
Mutual labels:  jupyter-notebook, timeseries
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 (+1078%)
Mutual labels:  jupyter-notebook, anomaly-detection
Datastream.io
An open-source framework for real-time anomaly detection using Python, ElasticSearch and Kibana
Stars: ✭ 814 (+1528%)
Mutual labels:  timeseries, anomaly-detection

Time series Anomaly detection

This is a times series anomaly detection algorithm implementation. It is used to catch multiple anomalies based on your time series data dependent on the confidence level you wish to set.

The anom_detect.py can be downloaded and imported, alternatively you can follow the Jupyter notebook to look at an example implementation, in particular it is important to check for normality of the data in order to use this method. The result of implementing this method is the generation of plots (shown below) and tables displaying the detected anomalies in your data.

As a general suggestion to anomaly detection is you should to get to know your data. This method is a simple implementation looking to see if the deviation of a point from the trend of the data is explained by the variation of the dataset or not. The selection of the signficance levels is dependent also on your ability to process anomalous points.

Implementation

The algorithm computes a moving average based on a certain window size. The moving average method used implements a simple low pass filter (using discrete linear convolution). This sounds complicated but it is not so bad (I will upload a blog to explain), it is nicer than rolling average methods which don't deal with boundaries of your data very well (early time data not properly averaged).
Then using the moving average as the trend of the data each points deviation from the moving average is calculated and then the generalized extreme Studentized deviate (ESD) test - an extension of the Grubbs test to multiple anomalies - is used to evaluate the actual data points to identify if they are likely to be anomalous dependent on a user set confidence level (alpha).

Example anomaly detection plot

Python Requirements

  • Python 3
  • Scipy
  • numpy
  • pandas
  • matplotlib

Improvements to be made

  • Treatment of sparse or missing time periods. At the moment it is believed that the data is continuous. If for example there are 300 consecutive days of data followed by 60 days of no data and then another 300 days of data, the current implementation will treat the data as 600 consecutive points. Meaning the trends of the initial 300 days will impact on the events 60 days afterwards.
    This will be corrected by implementing a gap detector, identifying gaps in the data which are greater than the size of the window.

Weakness in Approach

The use of a moving average is a simplistic approach and masks any continuous underlying trends such time dependent trends where STL methods may be more appropriate. In addition the use of ESD requires that the data be approximately normally distributed, this should be tested to ensure that this method is the correct application.

References

[1] Generalized ESD Test for Outliers, http://www.itl.nist.gov/div898/handbook/eda/section3/eda35h3.htm

[2] Convolution Implementation, https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.convolve.html

[3] STL method, http://www.statsmodels.org/stable/generated/statsmodels.tsa.seasonal.seasonal_decompose.html?highlight=seasonal

[4] Introducing practical and robust anomaly detection in a time series, https://blog.twitter.com/engineering/en_us/a/2015/introducing-practical-and-robust-anomaly-detection-in-a-time-series.html

[5] Introduction to Anomaly Detection, https://www.datascience.com/blog/python-anomaly-detection

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].