https://github.com/norskregnesentral/skchange
skchange provides sktime-compatible change detection and changepoint-based anomaly detection algorithms
https://github.com/norskregnesentral/skchange
anomaly-detection change-detection machine-learning statistics time-series-segmentation
Last synced: about 1 month ago
JSON representation
skchange provides sktime-compatible change detection and changepoint-based anomaly detection algorithms
- Host: GitHub
- URL: https://github.com/norskregnesentral/skchange
- Owner: NorskRegnesentral
- License: bsd-3-clause
- Created: 2023-11-27T10:57:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-10T19:39:04.000Z (about 1 month ago)
- Last Synced: 2025-04-10T19:52:21.686Z (about 1 month ago)
- Topics: anomaly-detection, change-detection, machine-learning, statistics, time-series-segmentation
- Language: Python
- Homepage: https://skchange.readthedocs.io
- Size: 4.6 MB
- Stars: 27
- Watchers: 4
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# skchange
[](https://codecov.io/gh/NorskRegnesentral/skchange)
[](https://github.com/NorskRegnesentral/skchange/actions/workflows/tests.yaml)
[](https://skchange.readthedocs.io/en/latest/?badge=latest)
[](https://github.com/sktime/sktime/blob/main/LICENSE)
[](https://github.com/psf/black)
[](https://pypi.org/project/skchange/)
[skchange]((https://skchange.readthedocs.io/en/latest/)) provides [sktime](https://www.sktime.net/)-compatible change detection and changepoint-based anomaly detection algorithms.
Experimental but maturing.
Check out the latest version: [v0.12.0](https://github.com/NorskRegnesentral/skchange/releases)
## Documentation
* [Documentation](https://skchange.readthedocs.io/)
* [Notebook tutorial](https://github.com/sktime/sktime-tutorial-pydata-global-2024)## Installation
It is recommended to install skchange with [numba](https://numba.readthedocs.io/en/stable/) for faster performance:
```sh
pip install skchange[numba]
```Alternatively, you can install skchange without numba:
```sh
pip install skchange
```## Quickstart
### Changepoint detection / time series segmentation
```python
from skchange.change_detectors import MovingWindow
from skchange.datasets import generate_alternating_datadf = generate_alternating_data(n_segments=10, segment_length=50, mean=5, random_state=1)
detector = MovingWindow(bandwidth=20)
detector.fit_predict(df)
```
```python
ilocs
0 50
1 100
2 150
3 200
4 250
5 300
6 350
7 400
8 450
```### Multivariate anomaly detection
```python
import numpy as np
from skchange.anomaly_detectors import MVCAPA
from skchange.datasets import generate_anomalous_datan = 300
anomalies = [(100, 120), (250, 300)]
means = [[8.0, 0.0, 0.0], [2.0, 3.0, 5.0]]
df = generate_anomalous_data(n, anomalies, means, random_state=3)detector = MVCAPA()
detector.fit_predict(df)
```
```python
ilocs labels icolumns
0 [100, 120) 1 [0]
1 [250, 300) 2 [2, 1, 0]
```## License
skchange is a free and open-source software licensed under the [BSD 3-clause license](https://github.com/NorskRegnesentral/skchange/blob/main/LICENSE).