# [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)
`skchange` provides sktime-compatible change detection and changepoint-based anomaly detection algorithms.
Experimental but maturing.
## [Documentation](https://skchange.readthedocs.io/en/latest/)
Now available.
## Installation
```sh
pip install skchange
```
Requires Python >= 3.9, < 3.13.
## Quickstart
### Changepoint detection / time series segmentation
```python
from skchange.change_detectors.moscore import Moscore
from skchange.datasets.generate import generate_alternating_data
df = generate_alternating_data(n_segments=10, segment_length=50, mean=5, random_state=1)
detector = Moscore(bandwidth=10)
detector.fit_predict(df)
```
```python
0 49
1 99
2 149
3 199
4 249
5 299
6 349
7 399
8 449
Name: changepoint, dtype: int64
```
### 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, 119), (250, 299)]
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
anomaly_interval anomaly_columns
0 [100, 119] [0]
1 [250, 299] [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/9d/c8/41b8f6ac7888ff5837ef7d5ba84db22e4222d4090a228e1e8af16d7e72f7/skchange-0.8.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\r\n`skchange` provides sktime-compatible change detection and changepoint-based anomaly detection algorithms.\r\n\r\nExperimental but maturing.\r\n\r\n## [Documentation](https://skchange.readthedocs.io/en/latest/)\r\nNow available.\r\n\r\n\r\n## Installation\r\n```sh\r\npip install skchange\r\n```\r\nRequires Python >= 3.9, < 3.13.\r\n\r\n## Quickstart\r\n\r\n### Changepoint detection / time series segmentation\r\n```python\r\nfrom skchange.change_detectors.moscore import Moscore\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 = Moscore(bandwidth=10)\r\ndetector.fit_predict(df)\r\n```\r\n```python\r\n0 49\r\n1 99\r\n2 149\r\n3 199\r\n4 249\r\n5 299\r\n6 349\r\n7 399\r\n8 449\r\nName: changepoint, dtype: int64\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, 119), (250, 299)]\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 anomaly_interval anomaly_columns\r\n0 [100, 119] [0]\r\n1 [250, 299] [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.8.1",
"project_urls": {
"Homepage": "https://github.com/NorskRegnesentral/skchange"
},
"split_keywords": [
"data-science",
" machine-learning",
" statistics",
" scikit-learn",
" time-series",
" change-detection",
" anomaly-detection"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b7a689dcc4942d0268bcc717dc751ce75e6115ba1151a45cc7fd85262e6af64a",
"md5": "ccd050db2e58687b1b451b660765341c",
"sha256": "f089bc3d450fa32afd6b7a0e1d6323f6cc8d56b61bbd0827f00a31533eb79811"
},
"downloads": -1,
"filename": "skchange-0.8.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ccd050db2e58687b1b451b660765341c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.9",
"size": 4294550,
"upload_time": "2024-10-17T07:37:43",
"upload_time_iso_8601": "2024-10-17T07:37:43.022573Z",
"url": "https://files.pythonhosted.org/packages/b7/a6/89dcc4942d0268bcc717dc751ce75e6115ba1151a45cc7fd85262e6af64a/skchange-0.8.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9dc841b8f6ac7888ff5837ef7d5ba84db22e4222d4090a228e1e8af16d7e72f7",
"md5": "15bbdb453fde91ab9de421704646344e",
"sha256": "791d1d66a4ab627991f5ff885de0e9b344a9d6cc12db53f590871b0d4bffad78"
},
"downloads": -1,
"filename": "skchange-0.8.1.tar.gz",
"has_sig": false,
"md5_digest": "15bbdb453fde91ab9de421704646344e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.9",
"size": 3916602,
"upload_time": "2024-10-17T07:37:45",
"upload_time_iso_8601": "2024-10-17T07:37:45.440573Z",
"url": "https://files.pythonhosted.org/packages/9d/c8/41b8f6ac7888ff5837ef7d5ba84db22e4222d4090a228e1e8af16d7e72f7/skchange-0.8.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-17 07:37:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "NorskRegnesentral",
"github_project": "skchange",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "skchange"
}