Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takuti/anompy
A Python library for anomaly detection
https://github.com/takuti/anompy
anomaly-detection data-science forecasting machine-learning python
Last synced: about 1 month ago
JSON representation
A Python library for anomaly detection
- Host: GitHub
- URL: https://github.com/takuti/anompy
- Owner: takuti
- License: mit
- Created: 2016-10-15T03:50:31.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-28T08:04:00.000Z (about 7 years ago)
- Last Synced: 2024-10-04T15:59:24.569Z (about 2 months ago)
- Topics: anomaly-detection, data-science, forecasting, machine-learning, python
- Language: Python
- Size: 34.2 KB
- Stars: 13
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
anompy
===**anompy** is a Python package of forecasting and anomaly detection algorithms.
## Installation
```
$ pip install git+https://github.com/takuti/anompy.git
```## Usage
Generate dummy time-series:
```py
>>> 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:
```py
>>> 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:
```py
>>> 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](https://gist.github.com/takuti/36d54e432a49424bb31d948926cd49b4) for more examples.
## Algorithm
anompy currently supports following algorithms:
- `BaseDetector`
- Directly use the last observation as a forecasted value, and detect anomaly based on threshold.
- `AverageDetector`
- Forecast either global average, simple moving average or weighted moving average.
- `ExponentialSmoothing`, `DoubleExponentialSmoothing`, and `TripleExponentialSmoothing`
- See ["Exponential smoothing" on Wikipedia](https://en.wikipedia.org/wiki/Exponential_smoothing).
- Triple exponential smoothing is also known as Holt-Winters method.
- Experimental
- `ChangeFinder`
- `SingularSpectrumTransform`
- `StreamAnomalyDetector`