Name | dtaianomaly JSON |
Version |
0.1.3
JSON |
| download |
home_page | |
Summary | A simple-to-use Python package for time series anomaly detection! |
upload_time | 2023-11-07 11:16:46 |
maintainer | |
docs_url | None |
author | |
requires_python | <=3.11,>=3.6 |
license | MIT License Copyright (c) 2023 KU Leuven, DTAI Research Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
machine-learning
time-series
anomaly-detection
data-mining
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Time Series Anomaly Detection
[![pipeline status](https://gitlab.kuleuven.be/u0143709/dtaianomaly/badges/main/pipeline.svg)](https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/pipelines)
[![coverage report](https://gitlab.kuleuven.be/u0143709/dtaianomaly/badges/main/coverage.svg)](https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/commits/main)
[![Latest Release](https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/badges/release.svg)](https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/releases)
[![Downloads](https://static.pepy.tech/badge/dtaianomaly)](https://pepy.tech/project/dtaianomaly)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/dtaianomaly.svg)](https://pypi.python.org/pypi/dtaianomaly/)
[![PyPI license](https://img.shields.io/pypi/l/dtaianomaly.svg)](https://pypi.python.org/pypi/dtaianomaly/)
> **_IMPORTANT:_** `dtaianomaly` is still a work in progress. Therefore, many changes
> are still expected. Feel free to [contact us](#contact) if there are any suggestions!
A simple-to-use Python package for the development and analysis of time series anomaly
detection techniques. Here we describe the main usage of `dtaianomaly`, but be sure to
check out the [documentation](https://u0143709.pages.gitlab.kuleuven.be/dtaianomaly/)
for more information.
## Installation
The easiest way to install the latest release of `dtaianomaly` is through [PyPi](https://pypi.org/project/dtaianomaly/):
```
pip install dtaianomaly
```
## Features
The three key features of `dtaianomaly` are as follows:
1. **Large scale experiments.** To evaluate anomaly detection methods, it is crucial to
be able to perform large scale experiments. However, it is also crucial to ensure
reproducibility of the obtained results. ´dtaianomaly´ provides a simple way to evaluate
an anomaly detector on a large set of time sets. This allows to both (1) quantitatively
evaluate the method by measuring the performance, runtime and memory usage, and (2)
qualitatively evaluate the method by visually inspecting the detected anomalies.
This is achieved by using configuration files, which ensure that identical settings
are used for the experiments. We refer to the [documentation](https://u0143709.pages.gitlab.kuleuven.be/dtaianomaly/getting_started/experiments.html) for more details regarding
how to set up and run experiments.
2. **Develop anomaly detectors.** The models in `dtaianomaly` are all centered around the
`TimeSeriesAnomalyDetector` class, which provides an interface to detecting anomalies in
time series. The main advantage of this abstract class is that anomaly detectors can be
handled in an abstract manner. This allows to develop wrapper approaches around existing
methods, without needing information about the specific algorithm. On top of this, by
only implementing the interface of `TimeSeriesAnomalyDetector`, it is possible to develop
new methods that can be used within the entire infrastructure of `dtaianomaly`. An example
of how to implement a custom anomaly detector is given in [this notebook](notebooks/custom_anomaly_detector.ipynb).
3. **Detect anomalies through a simple API.** Once an anomaly detector is developed and
validated, it can be used to detect anomalies in time series. `dtaianomaly` provides
a simple API (through `fit` and `predict` methods) to detect anomalies. The below code
snippet illustrates how to detect anomalies in only a few lines of code. The complete
example can be found in [this notebook](notebooks/README_demo.ipynb). The main advantage
of ´dtaianomaly´ is that anomaly detectors can be used as a wrapper approach. Thus, you
do not need to know anything about the ´TimeSeriesAnomalyDetector´ in order to
detect anomalies.
```python
from dtaianomaly.anomaly_detection import PyODAnomalyDetector, Windowing
trend_data = ... # Some time series as a numpy array of shape (n_samples, n_features)
# Initialize an IForest that takes as features each window of 100 observations
anomaly_detector = PyODAnomalyDetector('IForest', Windowing(window_size=100))
# Fit the anomaly detector
anomaly_detector.fit(trend_data)
# Compute the raw anomaly scores of an observation (in range [0, infinity])
raw_anomaly_scores = anomaly_detector.decision_function(trend_data)
# Compute the probability of an observation being an anomaly (in range [0, 1])
anomaly_probabilities = anomaly_detector.predict_proba(trend_data)
```
![Anomaly scores](https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/raw/main/notebooks/README_demo.svg?inline=false)
## Examples
Several examples of how `dtaianomaly` can be used are provided in the [notebooks](notebooks). Here
we list some of the most important ones to get to know `dtaianomaly`:
- [Quantitatively evaluate an anomaly detector](notebooks/execute_workflow.ipynb): Shows how to
quantitatively evaluate an anomaly detector on a benchmark set of time series.
- [Custom anomaly detector](notebooks/custom_anomaly_detector.ipynb): Illustrates a simple example
of a custom anomaly detector implemented in `dtaianomaly`.
- [PyOD anomaly detectors](notebooks/analyze_pyod_anomaly_detectors.ipynb): Compares different anomaly detection algorithms
implemented in the [PyOD](https://pyod.readthedocs.io/en/latest/) library, showing how you can use an anomaly
detector as a wrapper approach.
## Dependencies
Time series are represented as [NumPy](https://numpy.org/)-arrays to detect anomalies, but can
also be represented as [Pandas](https://pandas.pydata.org/) DataFrames for visualization. Anomaly
detection algorithms use the [PyOD](https://pyod.readthedocs.io/en/latest/) library. We use
[matplotlib](https://matplotlib.org/) for visualization.
`dtaianomaly` also depends on [scikit-learn](https://scikit-learn.org/stable/) and
[scipy](https://www.scipy.org/), but we plan on removing these dependencies in the near future.
## Contact
Feel free to email to [louis.carpentier@kuleuven.be](mailto:louis.carpentier@kuleuven.be) if
there are any questions, remarks, ideas, ...
## License
Copyright (c) 2023 KU Leuven, DTAI Research Group
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Raw data
{
"_id": null,
"home_page": "",
"name": "dtaianomaly",
"maintainer": "",
"docs_url": null,
"requires_python": "<=3.11,>=3.6",
"maintainer_email": "",
"keywords": "machine-learning,time-series,anomaly-detection,data-mining",
"author": "",
"author_email": "Louis Carpentier <louis.carpentier@kuleuven.be>",
"download_url": "https://files.pythonhosted.org/packages/c2/c5/15d6b197cb0021a0a92cc6cf8a9792719df9b1286a5b825c8a6b8159c96a/dtaianomaly-0.1.3.tar.gz",
"platform": null,
"description": "# Time Series Anomaly Detection\r\n\r\n\r\n[![pipeline status](https://gitlab.kuleuven.be/u0143709/dtaianomaly/badges/main/pipeline.svg)](https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/pipelines)\r\n[![coverage report](https://gitlab.kuleuven.be/u0143709/dtaianomaly/badges/main/coverage.svg)](https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/commits/main)\r\n[![Latest Release](https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/badges/release.svg)](https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/releases)\r\n[![Downloads](https://static.pepy.tech/badge/dtaianomaly)](https://pepy.tech/project/dtaianomaly)\r\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/dtaianomaly.svg)](https://pypi.python.org/pypi/dtaianomaly/)\r\n[![PyPI license](https://img.shields.io/pypi/l/dtaianomaly.svg)](https://pypi.python.org/pypi/dtaianomaly/)\r\n\r\n\r\n> **_IMPORTANT:_** `dtaianomaly` is still a work in progress. Therefore, many changes \r\n> are still expected. Feel free to [contact us](#contact) if there are any suggestions!\r\n\r\nA simple-to-use Python package for the development and analysis of time series anomaly \r\ndetection techniques. Here we describe the main usage of `dtaianomaly`, but be sure to\r\ncheck out the [documentation](https://u0143709.pages.gitlab.kuleuven.be/dtaianomaly/) \r\nfor more information. \r\n\r\n## Installation\r\nThe easiest way to install the latest release of `dtaianomaly` is through [PyPi](https://pypi.org/project/dtaianomaly/):\r\n```\r\npip install dtaianomaly\r\n```\r\n\r\n## Features\r\nThe three key features of `dtaianomaly` are as follows:\r\n1. **Large scale experiments.** To evaluate anomaly detection methods, it is crucial to\r\n be able to perform large scale experiments. However, it is also crucial to ensure \r\n reproducibility of the obtained results. \u00b4dtaianomaly\u00b4 provides a simple way to evaluate\r\n an anomaly detector on a large set of time sets. This allows to both (1) quantitatively \r\n evaluate the method by measuring the performance, runtime and memory usage, and (2)\r\n qualitatively evaluate the method by visually inspecting the detected anomalies. \r\n This is achieved by using configuration files, which ensure that identical settings\r\n are used for the experiments. We refer to the [documentation](https://u0143709.pages.gitlab.kuleuven.be/dtaianomaly/getting_started/experiments.html) for more details regarding\r\n how to set up and run experiments.\r\n2. **Develop anomaly detectors.** The models in `dtaianomaly` are all centered around the\r\n `TimeSeriesAnomalyDetector` class, which provides an interface to detecting anomalies in\r\n time series. The main advantage of this abstract class is that anomaly detectors can be\r\n handled in an abstract manner. This allows to develop wrapper approaches around existing \r\n methods, without needing information about the specific algorithm. On top of this, by \r\n only implementing the interface of `TimeSeriesAnomalyDetector`, it is possible to develop\r\n new methods that can be used within the entire infrastructure of `dtaianomaly`. An example\r\n of how to implement a custom anomaly detector is given in [this notebook](notebooks/custom_anomaly_detector.ipynb).\r\n3. **Detect anomalies through a simple API.** Once an anomaly detector is developed and\r\n validated, it can be used to detect anomalies in time series. `dtaianomaly` provides \r\n a simple API (through `fit` and `predict` methods) to detect anomalies. The below code \r\n snippet illustrates how to detect anomalies in only a few lines of code. The complete \r\n example can be found in [this notebook](notebooks/README_demo.ipynb). The main advantage \r\n of \u00b4dtaianomaly\u00b4 is that anomaly detectors can be used as a wrapper approach. Thus, you \r\n do not need to know anything about the \u00b4TimeSeriesAnomalyDetector\u00b4 in order to\r\n detect anomalies. \r\n\r\n```python\r\nfrom dtaianomaly.anomaly_detection import PyODAnomalyDetector, Windowing\r\n\r\ntrend_data = ... # Some time series as a numpy array of shape (n_samples, n_features)\r\n\r\n# Initialize an IForest that takes as features each window of 100 observations\r\nanomaly_detector = PyODAnomalyDetector('IForest', Windowing(window_size=100))\r\n\r\n# Fit the anomaly detector \r\nanomaly_detector.fit(trend_data)\r\n# Compute the raw anomaly scores of an observation (in range [0, infinity])\r\nraw_anomaly_scores = anomaly_detector.decision_function(trend_data)\r\n# Compute the probability of an observation being an anomaly (in range [0, 1])\r\nanomaly_probabilities = anomaly_detector.predict_proba(trend_data)\r\n```\r\n![Anomaly scores](https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/raw/main/notebooks/README_demo.svg?inline=false)\r\n\r\n## Examples\r\nSeveral examples of how `dtaianomaly` can be used are provided in the [notebooks](notebooks). Here\r\nwe list some of the most important ones to get to know `dtaianomaly`:\r\n- [Quantitatively evaluate an anomaly detector](notebooks/execute_workflow.ipynb): Shows how to \r\n quantitatively evaluate an anomaly detector on a benchmark set of time series. \r\n- [Custom anomaly detector](notebooks/custom_anomaly_detector.ipynb): Illustrates a simple example \r\n of a custom anomaly detector implemented in `dtaianomaly`. \r\n- [PyOD anomaly detectors](notebooks/analyze_pyod_anomaly_detectors.ipynb): Compares different anomaly detection algorithms \r\n implemented in the [PyOD](https://pyod.readthedocs.io/en/latest/) library, showing how you can use an anomaly \r\n detector as a wrapper approach. \r\n\r\n## Dependencies\r\nTime series are represented as [NumPy](https://numpy.org/)-arrays to detect anomalies, but can \r\nalso be represented as [Pandas](https://pandas.pydata.org/) DataFrames for visualization. Anomaly\r\ndetection algorithms use the [PyOD](https://pyod.readthedocs.io/en/latest/) library. We use \r\n[matplotlib](https://matplotlib.org/) for visualization. \r\n\r\n`dtaianomaly` also depends on [scikit-learn](https://scikit-learn.org/stable/) and \r\n[scipy](https://www.scipy.org/), but we plan on removing these dependencies in the near future.\r\n\r\n## Contact\r\nFeel free to email to [louis.carpentier@kuleuven.be](mailto:louis.carpentier@kuleuven.be) if \r\nthere are any questions, remarks, ideas, ...\r\n\r\n## License\r\n Copyright (c) 2023 KU Leuven, DTAI Research Group\r\n \r\n Permission is hereby granted, free of charge, to any person obtaining a copy\r\n of this software and associated documentation files (the \"Software\"), to deal\r\n in the Software without restriction, including without limitation the rights\r\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n copies of the Software, and to permit persons to whom the Software is\r\n furnished to do so, subject to the following conditions:\r\n \r\n The above copyright notice and this permission notice shall be included in all\r\n copies or substantial portions of the Software.\r\n \r\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n SOFTWARE.\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2023 KU Leuven, DTAI Research Group Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A simple-to-use Python package for time series anomaly detection!",
"version": "0.1.3",
"project_urls": {
"changelog": "https://gitlab.kuleuven.be/u0143709/dtaianomaly/-/blob/main/CHANGELOG.md",
"documentation": "https://u0143709.pages.gitlab.kuleuven.be/dtaianomaly/index.html",
"homepage": "https://pypi.org/project/dtaianomaly/",
"repository": "https://gitlab.kuleuven.be/u0143709/dtaianomaly"
},
"split_keywords": [
"machine-learning",
"time-series",
"anomaly-detection",
"data-mining"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3ef6aa1db36d93a0b2a337df60152c592cbd24bef22185c71aef6311e1a1afba",
"md5": "2a2326494882f635c8c52ef79009d3e6",
"sha256": "ef665734f706dd7a718f87741f4cdea154d9648c9cc79bad4c28e8c2abe53f8f"
},
"downloads": -1,
"filename": "dtaianomaly-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2a2326494882f635c8c52ef79009d3e6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<=3.11,>=3.6",
"size": 38553,
"upload_time": "2023-11-07T11:16:45",
"upload_time_iso_8601": "2023-11-07T11:16:45.422919Z",
"url": "https://files.pythonhosted.org/packages/3e/f6/aa1db36d93a0b2a337df60152c592cbd24bef22185c71aef6311e1a1afba/dtaianomaly-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c2c515d6b197cb0021a0a92cc6cf8a9792719df9b1286a5b825c8a6b8159c96a",
"md5": "7e598287ad765a7382f3ba9e21e01b57",
"sha256": "78f2a998410efcc07a04b601ad4119b4cab5bbb40b9f6aba428ba69177f4218d"
},
"downloads": -1,
"filename": "dtaianomaly-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "7e598287ad765a7382f3ba9e21e01b57",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<=3.11,>=3.6",
"size": 32014,
"upload_time": "2023-11-07T11:16:46",
"upload_time_iso_8601": "2023-11-07T11:16:46.602461Z",
"url": "https://files.pythonhosted.org/packages/c2/c5/15d6b197cb0021a0a92cc6cf8a9792719df9b1286a5b825c8a6b8159c96a/dtaianomaly-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-07 11:16:46",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "dtaianomaly"
}