# skchange
`skchange` provies sktime-compatible change detection and changepoint-based anomaly detection algorithms. Methods implement the annotator interface of sktime.
A playground for now.
[![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)
[![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)
## Installation
```sh
pip install skchange
```
Requires Python >= 3.8, < 3.13.
## Quickstart
### Changepoint detection / time series segmentation
```python
from skchange.change_detectors.moscore import Moscore
from skchange.datasets.generate import generate_teeth_data
df = generate_teeth_data(n_segments=10, segment_length=50, mean=5, random_state=1)
detector = Moscore(bandwidth=10, fmt="sparse")
detector.fit_predict(df)
>>>
0 49
1 99
2 149
3 199
4 249
5 299
6 349
7 399
8 449
Name: changepoints, dtype: int32
```
### Multivariate anomaly detection
```python
from skchange.anomaly_detectors.mvcapa import Mvcapa
from skchange.datasets.generate import generate_teeth_data
df = generate_teeth_data(
n_segments=5,
segment_length=50,
p=10,
mean=10,
affected_proportion=0.2,
random_state=2,
)
detector = Mvcapa(collective_penalty="sparse", fmt="sparse")
detector.fit_predict(df)
>>>
start end components
0 50 99 [0, 1]
1 150 199 [0, 1]
```
<!-- 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.8",
"maintainer_email": "Martin Tveten <tveten@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/98/9e/53af06481705dd3e1d695f607a99df343aa1b701cf6b89e7a437925b82a3/skchange-0.5.2.tar.gz",
"platform": null,
"description": "# skchange\r\n`skchange` provies sktime-compatible change detection and changepoint-based anomaly detection algorithms. Methods implement the annotator interface of sktime.\r\n\r\nA playground for now.\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[![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\r\n## Installation\r\n```sh\r\npip install skchange\r\n```\r\nRequires Python >= 3.8, < 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_teeth_data\r\n\r\ndf = generate_teeth_data(n_segments=10, segment_length=50, mean=5, random_state=1)\r\ndetector = Moscore(bandwidth=10, fmt=\"sparse\")\r\ndetector.fit_predict(df)\r\n>>>\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: changepoints, dtype: int32\r\n```\r\n\r\n### Multivariate anomaly detection\r\n```python\r\nfrom skchange.anomaly_detectors.mvcapa import Mvcapa\r\nfrom skchange.datasets.generate import generate_teeth_data\r\n\r\ndf = generate_teeth_data(\r\n n_segments=5,\r\n segment_length=50,\r\n p=10,\r\n mean=10,\r\n affected_proportion=0.2,\r\n random_state=2,\r\n)\r\ndetector = Mvcapa(collective_penalty=\"sparse\", fmt=\"sparse\")\r\ndetector.fit_predict(df)\r\n>>>\r\n start end components\r\n0 50 99 [0, 1]\r\n1 150 199 [0, 1]\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.5.2",
"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": "f479e8bc293a73df469f304a7bbe3b4e44e2ac0c0f570434fda3579060f81b2e",
"md5": "3a8a90d8d99c0b0a7dc061953467be14",
"sha256": "fc5acad938b5e468dc0fcc035df824e48a4a1c42c28e002ba76319b5a6f242a8"
},
"downloads": -1,
"filename": "skchange-0.5.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3a8a90d8d99c0b0a7dc061953467be14",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.8",
"size": 66871,
"upload_time": "2024-06-21T14:13:59",
"upload_time_iso_8601": "2024-06-21T14:13:59.493920Z",
"url": "https://files.pythonhosted.org/packages/f4/79/e8bc293a73df469f304a7bbe3b4e44e2ac0c0f570434fda3579060f81b2e/skchange-0.5.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "989e53af06481705dd3e1d695f607a99df343aa1b701cf6b89e7a437925b82a3",
"md5": "53c77dcbfb8b113ccf908bd6f84a6eb7",
"sha256": "ff3235b114a614c1edf2e6073907c23ac54bab0f1bfd09bfa07efe292e07586b"
},
"downloads": -1,
"filename": "skchange-0.5.2.tar.gz",
"has_sig": false,
"md5_digest": "53c77dcbfb8b113ccf908bd6f84a6eb7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.8",
"size": 44910,
"upload_time": "2024-06-21T14:15:24",
"upload_time_iso_8601": "2024-06-21T14:15:24.108979Z",
"url": "https://files.pythonhosted.org/packages/98/9e/53af06481705dd3e1d695f607a99df343aa1b701cf6b89e7a437925b82a3/skchange-0.5.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-21 14:15:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "NorskRegnesentral",
"github_project": "skchange",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "skchange"
}