https://github.com/lucew/changepoynt
Efficient and readable change point detection package implemented in Python. (Singular Spectrum Transformation - SST, IKA-SST, ulSIF, RuLSIF, KLIEP, FLUSS, FLOSS, etc.)
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, sciencedirect.com, springer.com, ieee.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.0%) to scientific vocabulary
Keywords
Repository
Efficient and readable change point detection package implemented in Python. (Singular Spectrum Transformation - SST, IKA-SST, ulSIF, RuLSIF, KLIEP, FLUSS, FLOSS, etc.)
Basic Info
Statistics
- Stars: 27
- Watchers: 2
- Forks: 2
- Open Issues: 0
- Releases: 3
Topics
Metadata Files
README.md
Python Changepoint Detection (changepoynt)
Table of content: - Quickstart - Examples - Algorithms - Installation - Contributing - Known Issues - 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
If you want to start using the package right away, we recommend using 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.scoreplotting import plotdataandscore # 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
steadybefore = np.ones(200) expsignal = np.exp(-np.linspace(0, 5, 200)) steadyafter = np.exp(-5)*np.ones(150) sineafter = 0.2np.sin(np.linspace(0, 3np.pi10, 300)) signal = np.concatenate((steadybefore, expsignal, steadyafter, sineafter)) signal += 0.01np.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
plotdataand_score(signal, detection) plt.show()
```
The result looks like this:

Examples
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. If you want to use the algorithms on the contents of a CSV directly, there is a frontend demonstrator currently hosted here (the adress is https://demo.changepoynt.de/, the code for the demonstrator is here).
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.

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, where we set the window size for the ESST to three times the estimated period in samples (estimated using maximum of FFT).

Both plots have been created using changepoynt.algorithms.esst and the plot function from
changepoynt.visualization.score_plotting.
Installation
You can install changepoynt from the common package index PyPi 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. Nevertheless, we aim to be open-source and try our best to guarantee that all the code we use has very permissive licenses.
You can also install the code from source using the following line
pip install git+https://github.com/Lucew/changepoynt.git
Frequently Asked Questions (FAQ)
Find the FAQs in the related Markdown document.
Algorithms
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é | Stable :heavycheckmark: | | IKA-SST | Idé | Stable :heavycheckmark: | | RSST | Weber | Experimental | | RuLSIF | Liu et al. | Stable :heavycheckmark: | | uLSIF | Liu et al. | Stable :heavycheckmark: | | KLIEP | Liu et al. | Planned | | ClaSP | Ermshaus et al. | Deactivated :x: | | FLUSS | Gharghabi et al. | Stable :heavycheckmark: | | FLOSS | Gharghabi et al. | Stable :heavycheckmark: | | BOCPD | Adams et al. | Experimental (mean change) | | Baseline | Weber | Stable :heavycheckmark: |
Contributing
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!
Known Issues
Division by Zero for SST with IKA
Some of the methods like SST (with method='ika') and (R)uLSIF have issues when running for trivial sections of time series. This includes steady series (e.g., only zero values, just lines with some slope). Intuitively, these methods aim to extract multiple characteristics in these sections but there are none, so they run into issues. Errors you will encounter are: "Matrix is singular" or "division by zero". Unfortunately, the math behind these errors is more complicated and I have not yet found a good way to circumvent these errors.
Fortunately, there is an easy workaround. Just add a small white noise to your signal, e.g. by adding
signal += np.random.normal(0, 1e-4, size=signal.shape[0]). With noise much smaller than you signal you will not
introduce large additional change points and the methods will not fail.
Python 3.13 no supported for all methods
We are aware that some dependencies currently are not supporting Python 3.13 and higher. These packages are mostly used for the fast_hankel option. We are currently discussing whether to make them optional.
Outlook
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 Bayesian online change point detection
If you have further ideas, do not hesitate to open a ticket or a pull request!
Owner
- Login: Lucew
- Kind: user
- Repositories: 2
- Profile: https://github.com/Lucew
GitHub Events
Total
- Watch event: 6
- Push event: 40
- Fork event: 1
- Create event: 1
Last Year
- Watch event: 6
- Push event: 40
- Fork event: 1
- Create event: 1
Committers
Last synced: about 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Lucas Weber | l****s@C****E | 133 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 1
- Total pull requests: 0
- Average time to close issues: about 1 month
- Average time to close pull requests: N/A
- Total issue authors: 1
- Total pull request authors: 0
- Average comments per issue: 2.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- 8Jimmy (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 191 last-month
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 8
- Total maintainers: 1
pypi.org: changepoynt
Efficient and readable change point detection package implemented in Python. (Singular Spectrum Transformation - SST, IKA-SST, ulSIF, RuLSIF, KLIEP, FLUSS, FLOSS, etc.)
- Homepage: https://github.com/Lucew/changepoynt
- Documentation: https://changepoynt.readthedocs.io/
- 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.
-
Latest release: 0.0.9
published 11 months ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- claspy >=0.1.6
- fbpca >=1.0
- matplotlib >=3.7.1
- numba >=0.56.4
- numpy >=1.23.5
- scipy >=1.10.1
- stumpy >=1.11.1
- claspy ==0.1.6
- fbpca ==1.0
- jupyter ==1.0.0
- numba *
- numpy *
- pytest *
- scipy *
- seaborn ==0.12.2
- stumpy ==1.11.1
- claspy ==0.1.6 test
- fbpca ==1.0 test
- numba * test
- numpy * test
- pytest * test
- scipy * test
- stumpy ==1.11.1 test
- python 3.11-slim build