# [`skchange`](https://skchange.readthedocs.io/en/latest/)
[![codecov](https://codecov.io/gh/NorskRegnesentral/skchange/graph/badge.svg?token=QSS3AY45KY)](https://codecov.io/gh/NorskRegnesentral/skchange)
[![tests](https://github.com/NorskRegnesentral/skchange/actions/workflows/tests.yaml/badge.svg)](https://github.com/NorskRegnesentral/skchange/actions/workflows/tests.yaml)
[![docs](https://readthedocs.org/projects/skchange/badge/?version=latest)](https://skchange.readthedocs.io/en/latest/?badge=latest)
[![BSD 3-clause](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://github.com/sktime/sktime/blob/main/LICENSE)
[![!black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Python](https://img.shields.io/pypi/pyversions/skchange)](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
[Docs](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]
```
<!-- Optional dependencies:
- Penalty tuning: `optuna` >= 3.1.1
- Plotting: `plotly` >= 5.13.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.13,>=3.9",
"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/00/75/16a311d45cd7a216190726219b1a0e01fa77498c2ffdf4cdb08227470e3f/skchange-0.9.1.tar.gz",
"platform": null,
"description": "# [`skchange`](https://skchange.readthedocs.io/en/latest/)\r\n\r\n[![codecov](https://codecov.io/gh/NorskRegnesentral/skchange/graph/badge.svg?token=QSS3AY45KY)](https://codecov.io/gh/NorskRegnesentral/skchange)\r\n[![tests](https://github.com/NorskRegnesentral/skchange/actions/workflows/tests.yaml/badge.svg)](https://github.com/NorskRegnesentral/skchange/actions/workflows/tests.yaml)\r\n[![docs](https://readthedocs.org/projects/skchange/badge/?version=latest)](https://skchange.readthedocs.io/en/latest/?badge=latest)\r\n[![BSD 3-clause](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://github.com/sktime/sktime/blob/main/LICENSE)\r\n[![!black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\r\n[![Python](https://img.shields.io/pypi/pyversions/skchange)](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[Docs](https://skchange.readthedocs.io/) | [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\r\n<!-- Optional dependencies:\r\n- Penalty tuning: `optuna` >= 3.1.1\r\n- Plotting: `plotly` >= 5.13.0. -->\r\n\r\n\r\n## License\r\n\r\n`skchange` 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.9.1",
"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": "e3a4f9c50bd35547a87b34a69ad48ea96536808d9aac02163a0c16f5de8d2760",
"md5": "2c31dff7975aeb5f2bbfa98475439220",
"sha256": "9b3c85c469628d5c44f8207ce45bdd90af1971e55dfe693bd9f27f8454887c75"
},
"downloads": -1,
"filename": "skchange-0.9.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c31dff7975aeb5f2bbfa98475439220",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.9",
"size": 7051443,
"upload_time": "2024-12-04T12:21:15",
"upload_time_iso_8601": "2024-12-04T12:21:15.592688Z",
"url": "https://files.pythonhosted.org/packages/e3/a4/f9c50bd35547a87b34a69ad48ea96536808d9aac02163a0c16f5de8d2760/skchange-0.9.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "007516a311d45cd7a216190726219b1a0e01fa77498c2ffdf4cdb08227470e3f",
"md5": "132db1ad57ed4bec736bfbb799ad51f2",
"sha256": "6d70c01b46acfe3d481daf0041fc24a104c2f68f4d53135a3edf8c2efe916a8d"
},
"downloads": -1,
"filename": "skchange-0.9.1.tar.gz",
"has_sig": false,
"md5_digest": "132db1ad57ed4bec736bfbb799ad51f2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.9",
"size": 6552843,
"upload_time": "2024-12-04T12:21:20",
"upload_time_iso_8601": "2024-12-04T12:21:20.653215Z",
"url": "https://files.pythonhosted.org/packages/00/75/16a311d45cd7a216190726219b1a0e01fa77498c2ffdf4cdb08227470e3f/skchange-0.9.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-04 12:21:20",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "skchange"
}