Looking for a good package for anomaly detection in time series



Is there a comprehensive open source package (preferably in python or R) that can be used for anomaly detection in time series?

There is a one class SVM package in scikit-learn but it is not for the time series data. I’m looking for more sophisticated packages that, for example, use Bayesian networks for anomaly detection.


Posted 2018-05-24T18:19:22.807

Reputation: 1 162



I know I'm bit late here, but yes there is a package for anomaly detection along with outlier combination-frameworks.

The package is in Python and its name is pyod. It is published in JMLR.

It has multiple algorithms for following individual approaches:

  1. Linear Models for Outlier Detection (PCA,vMCD,vOne-Class, and SVM)
  2. Proximity-Based Outlier Detection Models (LOF, CBLOF, HBOS, KNN, AverageKNN, and MedianKNN)
  3. Probabilistic Models for Outlier Detection (ABOD and FastABOD)
  4. Outlier Ensembles and Combination Frameworks(IsolationForest and FeatureBagging)
  5. Neural Networks and Deep Learning Models (Auto-encoder with fully connected Neural Network)

Finally, if you're looking specifically for time-series per se, then this github link will be useful.

It has the following list packages for timeseries outlier detection:





Shankar Chavan

Posted 2018-05-24T18:19:22.807

Reputation: 326

any way to work on context based abnormalities? – Arpit Sisodia – 2019-08-09T10:19:17.637

are you talking about anomaly detection or outlier detection? There is a difference. – Arpit Sisodia – 2019-08-09T10:21:39.810


There are multiple ways to handle time series abnormalities-

  1. If abnormalities are known, build a classification model. Use this model to detect same type of abnormalities for time series data.

  2. If abnormalities are unknown, what we have done in our organization is a combination of clustering and classification.

First use LOF/K-means/Cook's distance to identify outliers. Convert entire data into classification problem as we have got 2 classes now- Outliers and normals. Now build a classification model and get rules (classification model ) to identify abnormality at run time (time series data).

  1. If abnormalities are unknown, during my research, most common way of identifying abnormalities is to build a normal model and any deviation from normal model (error) is abnormal, so in your case, you forecast your time series for next hour and then compare with actual values. If error is more than expected, something abnormal is happening.

I was not able to find any direct package in Python or R to do so, as nobody knows what is really abnormal, in all the cases it has been related to outlier detection.

This & this may be useful to you.

Arpit Sisodia

Posted 2018-05-24T18:19:22.807

Reputation: 365


Try Prophet Library

Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is robust to missing data and shifts in the trend, and typically handles outliers well.

More at: Anomaly detection in time series with Prophet library


Posted 2018-05-24T18:19:22.807

Reputation: 1 359