Name | changepoynt JSON |
Version |
0.0.8
JSON |
| download |
home_page | https://github.com/Lucew/changepoynt |
Summary | Several change point detection methods implemented in python. |
upload_time | 2024-06-05 16:54:29 |
maintainer | None |
docs_url | None |
author | Lucas Weber |
requires_python | >=3.8 |
license | BSD 2-Clause License Copyright (c) 2023, Lucas Weber All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
changepoint
timeseries
engineering
|
VCS |
|
bugtrack_url |
|
requirements |
numpy
numba
scipy
fbpca
matplotlib
stumpy
rocket-fft
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Python Changepoint Detection (changepoynt)
**Table of content:**
- [Quickstart](#quickstart)
- [Examples](#examples)
- [Algorithms](#algorithms)
- [Installation](#installation)
- [Contributing](#contributing)
- [Outlook](#outlook)
This is the repository hosting the **pip-installable** python package changepoynt. It implements several
change point detection techniques, while focusing mostly on "localized" algorithms, that could be run in an online
fashion.
Current algorithms come from the field of:
* Subspace Estimation (Extracting the characteristic signals)
* Statistics (Detection of Change in the statistical properties)
* Time Series Segmentation (Algorithms focused on comparing time series shape)
The package is aimed at execution performance (using JIT compilation and standing on the shoulders of giants like numpy
and scipy) while also keeping code readable and maintainable. This includes comments as well as architectural choices.
This might not be perfect, but we are trying!
All of our algorithms are implementations of a base changepoint detection interface and therefore are interchangeable.
Currently, we are focused on shifting to the very common and existing sklearn interface of fit and transform. This
enables our algorithms to be part of the standard sklearn pipeline for preprocessing.
# Quick Start <a id="quickstart"></a>
If you want to start using the package right away, we recommend to use one of the singular spectrum transformation
algorithms (SST). The first step is to install the package using pip. Then you can use the following example code:
```python
import numpy as np # for signal creation
import matplotlib.pyplot as plt # to show the plot
from changepoynt.algorithms.esst import ESST # import the scoring algorithm
from changepoynt.visualization.score_plotting import plot_data_and_score # import a visualization function
# simulate a signal that goes from exponential decline into a sine wave
# the signals is only for demonstration purposes and can be replaced by your signal
steady_before = np.ones(200)
exp_signal = np.exp(-np.linspace(0, 5, 200))
steady_after = np.exp(-5)*np.ones(150)
sine_after = 0.2*np.sin(np.linspace(0, 3*np.pi*10, 300))
signal = np.concatenate((steady_before, exp_signal, steady_after, sine_after))
signal += 0.01*np.random.randn(signal.shape[0]) # add some minor noise
# This part is all you need to do to score a signal with our package
# create the scorer and compute the change score
detector = ESST(30)
detection = detector.transform(signal)
# make the plot using the built-in function of the package
plot_data_and_score(signal, detection)
plt.show()
```
The result looks like this:
![image](https://github.com/Lucew/changepoynt/raw/master/images/minimal_example_result.png)
# Examples <a id="examples"></a>
You can find example code within the examples folder of this repository. We also wanted to tease the
functionality using two different signals in order to show the capabilities of one of our recommended algorithms
[ESST](https://github.com/Lucew/changepoynt/blob/master/changepoynt/algorithms/esst.py). If you want to use the
algorithms on the contents of a CSV directly, there is a frontend demonstrator currently hosted
[here](https://demo.changepoynt.de/) (the adress is https://demo.changepoynt.de/, the
code for the demonstrator is [here](https://github.com/Lucew/changepoynt/tree/master/frontend)).
The first application is a simulated temperature of a component in a power plant during shutdown.
We artificially added a disturbance at the end of the shutdown, to show the capability of the algorithm to
detect a change even in case of another major change.
![image](https://github.com/Lucew/changepoynt/raw/master/images/simulated_temperature_behavior.png)
The other application is for anomaly detection within periodic signals. The example is time series
34 from the
[Hexagon ML/UCR Time Series Anomaly Detection dataset](https://www.cs.ucr.edu/~eamonn/time_series_data_2018/), where we
set the window size for the ESST to three times the estimated period in samples (estimated using maximum of FFT).
![image](https://github.com/Lucew/changepoynt/raw/master/images/034_UCR_Anomaly_DISTORTEDInternalBleeding6_1500_3474_3629.png)
Both plots have been created using `changepoynt.algorithms.esst` and the plot function from
`changepoynt.visualization.score_plotting`.
# Installation <a id="installation"></a>
You can install `changepoynt` from the common package index [PyPi](https://pypi.org/project/changepoynt/) using the
following line with pip:
pip install changepoynt
Please be aware, that we are currently in an alpha development phase, as this is part of a research project at the FAU
Erlangen together with SIEMENS Energy developed by [me](https://www.cs6.tf.fau.de/person/lucas-weber/). Nevertheless,
we aim to be open-source and try our best to guarantee that all the code we use has very permissive licenses.
# Algorithms <a id="algorithms"></a>
We are actively working on the package. Therefore, some algorithms are already available, while others
are currently under development. An overview with sources can be seen here:
| Algorithm | Source | Status |
|-----------|-----------------------------------------------------------------------------------|--------------------------------|
| SST | [Idé](https://epubs.siam.org/doi/abs/10.1137/1.9781611972757.63) | Stable :heavy_check_mark: |
| IKA-SST | [Idé](https://epubs.siam.org/doi/abs/10.1137/1.9781611972771.54) | Stable :heavy_check_mark: |
| RSST | Weber | Experimental |
| RuLSIF | [Liu et al.](https://www.sciencedirect.com/science/article/pii/S0893608013000270) | Stable :heavy_check_mark: |
| uLSIF | [Liu et al.](https://www.sciencedirect.com/science/article/pii/S0893608013000270) | Stable :heavy_check_mark: |
| KLIEP | [Liu et al.](https://www.sciencedirect.com/science/article/pii/S0893608013000270) | Planned |
| ClaSP | [Ermshaus et al.](https://link.springer.com/article/10.1007/s10618-023-00923-x) | Deactivated :x: |
| FLUSS | [Gharghabi et al.](https://ieeexplore.ieee.org/abstract/document/8215484) | Stable :heavy_check_mark: |
| FLOSS | [Gharghabi et al.](https://ieeexplore.ieee.org/abstract/document/8215484) | Stable :heavy_check_mark: |
| BOCPD | [Adams et al.](https://arxiv.org/abs/0710.3742) | Planned |
# Contributing <a id="contributing"></a>
We always love to get feedback or new ideas. If you have any of those, feel free to open an issue. We try to get back to
you as soon as we can.
If you are an author of a paper in the field or have another algorithmic idea: Feel free to open a pull request.
Currently, we are still working on the contribution guides. But if somebody already comes along and has an idea, we do
not want to be in the way!
# Outlook <a id="outlook"></a>
We are actively working on the package, and currently have the following steps planned:
- We are actively working on a benchmark tool for change point algorithms
- Implement Bayesion online change point detection
If you have further ideas, do not hesitate to open a ticket or a pull request!
Raw data
{
"_id": null,
"home_page": "https://github.com/Lucew/changepoynt",
"name": "changepoynt",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "changepoint, timeseries, engineering",
"author": "Lucas Weber",
"author_email": "Lucas Weber <weber-lucas@web.de>",
"download_url": "https://files.pythonhosted.org/packages/bb/1c/98abc76e8ae5988e40ceb55b7b1baf6c412aadbc4b0bc3949209ca6dd1e0/changepoynt-0.0.8.tar.gz",
"platform": null,
"description": "# Python Changepoint Detection (changepoynt)\n\n**Table of content:**\n - [Quickstart](#quickstart)\n - [Examples](#examples)\n - [Algorithms](#algorithms)\n - [Installation](#installation)\n - [Contributing](#contributing)\n - [Outlook](#outlook)\n\nThis is the repository hosting the **pip-installable** python package changepoynt. It implements several \nchange point detection techniques, while focusing mostly on \"localized\" algorithms, that could be run in an online \nfashion.\n\n \n\nCurrent algorithms come from the field of:\n\n* Subspace Estimation (Extracting the characteristic signals)\n\n* Statistics (Detection of Change in the statistical properties)\n\n* Time Series Segmentation (Algorithms focused on comparing time series shape)\n\n\nThe package is aimed at execution performance (using JIT compilation and standing on the shoulders of giants like numpy \nand scipy) while also keeping code readable and maintainable. This includes comments as well as architectural choices. \nThis might not be perfect, but we are trying!\n\n \n\nAll of our algorithms are implementations of a base changepoint detection interface and therefore are interchangeable. \nCurrently, we are focused on shifting to the very common and existing sklearn interface of fit and transform. This \nenables our algorithms to be part of the standard sklearn pipeline for preprocessing.\n\n# Quick Start <a id=\"quickstart\"></a>\nIf you want to start using the package right away, we recommend to use one of the singular spectrum transformation\nalgorithms (SST). The first step is to install the package using pip. Then you can use the following example code:\n\n```python\nimport numpy as np # for signal creation\nimport matplotlib.pyplot as plt # to show the plot\nfrom changepoynt.algorithms.esst import ESST # import the scoring algorithm\nfrom changepoynt.visualization.score_plotting import plot_data_and_score # import a visualization function\n\n# simulate a signal that goes from exponential decline into a sine wave\n# the signals is only for demonstration purposes and can be replaced by your signal\nsteady_before = np.ones(200)\nexp_signal = np.exp(-np.linspace(0, 5, 200))\nsteady_after = np.exp(-5)*np.ones(150)\nsine_after = 0.2*np.sin(np.linspace(0, 3*np.pi*10, 300))\nsignal = np.concatenate((steady_before, exp_signal, steady_after, sine_after))\nsignal += 0.01*np.random.randn(signal.shape[0]) # add some minor noise\n\n# This part is all you need to do to score a signal with our package \n# create the scorer and compute the change score\ndetector = ESST(30)\ndetection = detector.transform(signal)\n\n# make the plot using the built-in function of the package \nplot_data_and_score(signal, detection)\nplt.show()\n\n```\n\nThe result looks like this:\n![image](https://github.com/Lucew/changepoynt/raw/master/images/minimal_example_result.png)\n\n# Examples <a id=\"examples\"></a>\n\nYou can find example code within the examples folder of this repository. We also wanted to tease the\nfunctionality using two different signals in order to show the capabilities of one of our recommended algorithms\n[ESST](https://github.com/Lucew/changepoynt/blob/master/changepoynt/algorithms/esst.py). If you want to use the \nalgorithms on the contents of a CSV directly, there is a frontend demonstrator currently hosted \n[here](https://demo.changepoynt.de/) (the adress is https://demo.changepoynt.de/, the \ncode for the demonstrator is [here](https://github.com/Lucew/changepoynt/tree/master/frontend)).\n\nThe first application is a simulated temperature of a component in a power plant during shutdown.\nWe artificially added a disturbance at the end of the shutdown, to show the capability of the algorithm to\ndetect a change even in case of another major change.\n\n![image](https://github.com/Lucew/changepoynt/raw/master/images/simulated_temperature_behavior.png)\n\nThe other application is for anomaly detection within periodic signals. The example is time series\n34 from the\n[Hexagon ML/UCR Time Series Anomaly Detection dataset](https://www.cs.ucr.edu/~eamonn/time_series_data_2018/), where we\nset the window size for the ESST to three times the estimated period in samples (estimated using maximum of FFT).\n\n![image](https://github.com/Lucew/changepoynt/raw/master/images/034_UCR_Anomaly_DISTORTEDInternalBleeding6_1500_3474_3629.png)\n \nBoth plots have been created using `changepoynt.algorithms.esst` and the plot function from \n`changepoynt.visualization.score_plotting`.\n\n# Installation <a id=\"installation\"></a>\n\nYou can install `changepoynt` from the common package index [PyPi](https://pypi.org/project/changepoynt/) using the \nfollowing line with pip:\n\n \n\n pip install changepoynt\n\n \n\nPlease be aware, that we are currently in an alpha development phase, as this is part of a research project at the FAU \nErlangen together with SIEMENS Energy developed by [me](https://www.cs6.tf.fau.de/person/lucas-weber/). Nevertheless, \nwe aim to be open-source and try our best to guarantee that all the code we use has very permissive licenses.\n\n# Algorithms <a id=\"algorithms\"></a>\n\nWe are actively working on the package. Therefore, some algorithms are already available, while others\nare currently under development. An overview with sources can be seen here:\n\n| Algorithm | Source | Status |\n|-----------|-----------------------------------------------------------------------------------|--------------------------------|\n| SST | [Id\u00e9](https://epubs.siam.org/doi/abs/10.1137/1.9781611972757.63) | Stable :heavy_check_mark: |\n| IKA-SST | [Id\u00e9](https://epubs.siam.org/doi/abs/10.1137/1.9781611972771.54) | Stable :heavy_check_mark: |\n| RSST | Weber | Experimental |\n| RuLSIF | [Liu et al.](https://www.sciencedirect.com/science/article/pii/S0893608013000270) | Stable :heavy_check_mark: |\n| uLSIF | [Liu et al.](https://www.sciencedirect.com/science/article/pii/S0893608013000270) | Stable :heavy_check_mark: |\n| KLIEP | [Liu et al.](https://www.sciencedirect.com/science/article/pii/S0893608013000270) | Planned |\n| ClaSP | [Ermshaus et al.](https://link.springer.com/article/10.1007/s10618-023-00923-x) | Deactivated :x: |\n| FLUSS | [Gharghabi et al.](https://ieeexplore.ieee.org/abstract/document/8215484) | Stable :heavy_check_mark: |\n| FLOSS | [Gharghabi et al.](https://ieeexplore.ieee.org/abstract/document/8215484) | Stable :heavy_check_mark: |\n| BOCPD | [Adams et al.](https://arxiv.org/abs/0710.3742) | Planned |\n\n\n\n# Contributing <a id=\"contributing\"></a>\n\nWe always love to get feedback or new ideas. If you have any of those, feel free to open an issue. We try to get back to\nyou as soon as we can.\n\n \n\nIf you are an author of a paper in the field or have another algorithmic idea: Feel free to open a pull request. \nCurrently, we are still working on the contribution guides. But if somebody already comes along and has an idea, we do \nnot want to be in the way!\n\n# Outlook <a id=\"outlook\"></a>\n\nWe are actively working on the package, and currently have the following steps planned:\n\n- We are actively working on a benchmark tool for change point algorithms\n- Implement Bayesion online change point detection\n\nIf you have further ideas, do not hesitate to open a ticket or a pull request!\n",
"bugtrack_url": null,
"license": "BSD 2-Clause License Copyright (c) 2023, Lucas Weber All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
"summary": "Several change point detection methods implemented in python.",
"version": "0.0.8",
"project_urls": {
"Homepage": "https://github.com/Lucew/changepoynt",
"Issues": "https://github.com/Lucew/changepoynt/issues"
},
"split_keywords": [
"changepoint",
" timeseries",
" engineering"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "207f4742bf7bad0b40fd4c1f839cb2d907155d3a705def7d8506d73909ecf0f7",
"md5": "4cdfc5dbfd1baf99d67a1dcb7df986c7",
"sha256": "8dce345a0849678a0c4b21bd737e1355b178afe355e9cb2f31f3d052ccf9d6a9"
},
"downloads": -1,
"filename": "changepoynt-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4cdfc5dbfd1baf99d67a1dcb7df986c7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 48046,
"upload_time": "2024-06-05T16:54:27",
"upload_time_iso_8601": "2024-06-05T16:54:27.519865Z",
"url": "https://files.pythonhosted.org/packages/20/7f/4742bf7bad0b40fd4c1f839cb2d907155d3a705def7d8506d73909ecf0f7/changepoynt-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bb1c98abc76e8ae5988e40ceb55b7b1baf6c412aadbc4b0bc3949209ca6dd1e0",
"md5": "d9fa24256f5e64d8cdaaaa94c7b99127",
"sha256": "1da039a3904f1b656aebfc96b5ede13d30bfd5eaa7785dc9fc1caad1b866de2f"
},
"downloads": -1,
"filename": "changepoynt-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "d9fa24256f5e64d8cdaaaa94c7b99127",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 41942,
"upload_time": "2024-06-05T16:54:29",
"upload_time_iso_8601": "2024-06-05T16:54:29.097550Z",
"url": "https://files.pythonhosted.org/packages/bb/1c/98abc76e8ae5988e40ceb55b7b1baf6c412aadbc4b0bc3949209ca6dd1e0/changepoynt-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-05 16:54:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Lucew",
"github_project": "changepoynt",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
">=",
"1.23.5"
]
]
},
{
"name": "numba",
"specs": [
[
">=",
"0.56.4"
]
]
},
{
"name": "scipy",
"specs": [
[
">=",
"1.10.1"
]
]
},
{
"name": "fbpca",
"specs": [
[
">=",
"1.0"
]
]
},
{
"name": "matplotlib",
"specs": [
[
">=",
"3.7.1"
]
]
},
{
"name": "stumpy",
"specs": [
[
">=",
"1.11.1"
]
]
},
{
"name": "rocket-fft",
"specs": []
}
],
"lcname": "changepoynt"
}