# 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.
## 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.moving_window import MovingWindow
from skchange.datasets.generate import generate_alternating_data
df = generate_alternating_data(n_segments=10, segment_length=50, mean=5, random_state=1)
detector = MovingWindow(bandwidth=10)
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.generate import generate_anomalous_data
n = 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).
Raw data
{
"_id": null,
"home_page": null,
"name": "skchange",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.10",
"maintainer_email": "Martin Tveten <tveten@nr.no>, Johannes Voll Kolst\u00f8 <jvkolsto@nr.no>",
"keywords": "data-science, machine-learning, statistics, scikit-learn, time-series, change-detection, anomaly-detection",
"author": null,
"author_email": "Martin Tveten <tveten@nr.no>",
"download_url": "https://files.pythonhosted.org/packages/30/82/900f478ab557d58e1a5cd6b83cf2751b6b3bb197a4932a6fe976c15ca7f2/skchange-0.11.0.tar.gz",
"platform": null,
"description": "# skchange\r\n\r\n[](https://codecov.io/gh/NorskRegnesentral/skchange)\r\n[](https://github.com/NorskRegnesentral/skchange/actions/workflows/tests.yaml)\r\n[](https://skchange.readthedocs.io/en/latest/?badge=latest)\r\n[](https://github.com/sktime/sktime/blob/main/LICENSE)\r\n[](https://github.com/psf/black)\r\n[](https://pypi.org/project/skchange/)\r\n\r\n[skchange]((https://skchange.readthedocs.io/en/latest/)) provides [sktime](https://www.sktime.net/)-compatible change detection and changepoint-based anomaly detection algorithms.\r\n\r\nExperimental but maturing.\r\n\r\n## Documentation\r\n\r\n* [Documentation](https://skchange.readthedocs.io/)\r\n* [Notebook tutorial](https://github.com/sktime/sktime-tutorial-pydata-global-2024)\r\n\r\n\r\n## Installation\r\nIt is recommended to install skchange with [numba](https://numba.readthedocs.io/en/stable/) for faster performance:\r\n```sh\r\npip install skchange[numba]\r\n```\r\n\r\nAlternatively, you can install skchange without numba:\r\n```sh\r\npip install skchange\r\n```\r\n\r\n## Quickstart\r\n\r\n### Changepoint detection / time series segmentation\r\n```python\r\nfrom skchange.change_detectors.moving_window import MovingWindow\r\nfrom skchange.datasets.generate import generate_alternating_data\r\n\r\ndf = generate_alternating_data(n_segments=10, segment_length=50, mean=5, random_state=1)\r\n\r\ndetector = MovingWindow(bandwidth=10)\r\ndetector.fit_predict(df)\r\n```\r\n```python\r\n ilocs\r\n0 50\r\n1 100\r\n2 150\r\n3 200\r\n4 250\r\n5 300\r\n6 350\r\n7 400\r\n8 450\r\n```\r\n\r\n### Multivariate anomaly detection\r\n```python\r\nimport numpy as np\r\nfrom skchange.anomaly_detectors import MVCAPA\r\nfrom skchange.datasets.generate import generate_anomalous_data\r\n\r\nn = 300\r\nanomalies = [(100, 120), (250, 300)]\r\nmeans = [[8.0, 0.0, 0.0], [2.0, 3.0, 5.0]]\r\ndf = generate_anomalous_data(n, anomalies, means, random_state=3)\r\n\r\ndetector = MVCAPA()\r\ndetector.fit_predict(df)\r\n```\r\n```python\r\n ilocs labels icolumns\r\n0 [100, 120) 1 [0]\r\n1 [250, 300) 2 [2, 1, 0]\r\n```\r\n\r\n## License\r\n\r\nskchange is a free and open-source software licensed under the [BSD 3-clause license](https://github.com/NorskRegnesentral/skchange/blob/main/LICENSE).\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Sktime-compatible change and anomaly detection",
"version": "0.11.0",
"project_urls": {
"Homepage": "https://skchange.readthedocs.io"
},
"split_keywords": [
"data-science",
" machine-learning",
" statistics",
" scikit-learn",
" time-series",
" change-detection",
" anomaly-detection"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "44f3ffacaefbc3e03f182160aba2ad1f621356da6d074082b90fdc3b8790f52f",
"md5": "19fe34b783d54d16156d929ae3c4c8e8",
"sha256": "6d5679b37be0d65ba8a47871f8c9f9582661f3e8dd24b858727f82a7a09d3b4a"
},
"downloads": -1,
"filename": "skchange-0.11.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "19fe34b783d54d16156d929ae3c4c8e8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.10",
"size": 8069119,
"upload_time": "2025-02-03T10:08:37",
"upload_time_iso_8601": "2025-02-03T10:08:37.296251Z",
"url": "https://files.pythonhosted.org/packages/44/f3/ffacaefbc3e03f182160aba2ad1f621356da6d074082b90fdc3b8790f52f/skchange-0.11.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3082900f478ab557d58e1a5cd6b83cf2751b6b3bb197a4932a6fe976c15ca7f2",
"md5": "85613419bf234bc6e3af47a4711c2dcf",
"sha256": "8b5496ff0111eb1e843d67ff66c1379a8d18fab0dbc8def37ba244544e386bed"
},
"downloads": -1,
"filename": "skchange-0.11.0.tar.gz",
"has_sig": false,
"md5_digest": "85613419bf234bc6e3af47a4711c2dcf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.10",
"size": 7496864,
"upload_time": "2025-02-03T10:08:40",
"upload_time_iso_8601": "2025-02-03T10:08:40.168749Z",
"url": "https://files.pythonhosted.org/packages/30/82/900f478ab557d58e1a5cd6b83cf2751b6b3bb197a4932a6fe976c15ca7f2/skchange-0.11.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-03 10:08:40",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "skchange"
}