anompy is a Python package of forecasting and anomaly detection algorithms.
$ pip install git+https://github.com/takuti/anompy.git
Generate dummy time-series:
>>> import random
>>> series = [random.random() for i in range(10)]
>>> series
[0.29749066250070444, 0.17992724665541393, 0.24201406949661697, 0.3467356134915024, 0.45318143064943217, 0.20825014566859423, 0.597497516445304, 0.5442072127508967, 0.1920841531842088, 0.2711214524302953]
Import BaseDetector
which simply returns the last observed data point as a forecasted value, and create a detector with initial data point (i.e., training sample) and threshold:
>>> from anompy.detector.base import BaseDetector
>>> detector = BaseDetector(series[0], threshold=0.5)
Get forecasted time-series and their anomaly labels by calling detect()
method:
>>> detector.detect(series[1:])
[(0.29749066250070444, False), (0.17992724665541393, False), (0.24201406949661697, False), (0.3467356134915024, False), (0.45318143064943217, False), (0.20825014566859423, False), (0.597497516445304, True), (0.5442072127508967, True), (0.1920841531842088, False)]
See this notebook for more examples.
anompy currently supports following algorithms:
BaseDetector
AverageDetector
ExponentialSmoothing
, DoubleExponentialSmoothing
, and TripleExponentialSmoothing
ChangeFinder
SingularSpectrumTransform
StreamAnomalyDetector