claspy


Nameclaspy JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://github.com/ermshaua/claspy
Summary
upload_time2024-01-10 13:32:25
maintainer
docs_urlNone
authorArik Ermshaus
requires_python>=3.7,<3.12
licenseBSD 3-Clause License Copyright (c) 2023, Arik Ermshaus Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords machine-learning time-series unsupervised-learning segmentation change-points
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ClaSPy: A Python package for time series segmentation
[![PyPI version](https://badge.fury.io/py/claspy.svg)](https://pypi.org/project/claspy/) [![Downloads](https://pepy.tech/badge/claspy)](https://pepy.tech/project/claspy)

Time series segmentation (TSS) tries to partition a time series (TS) into semantically meaningful segments. It's an important unsupervised learning task applied to large, real-world sensor signals for human inspection, change point detection or as preprocessing for classification and anomaly detection. This python library is the official implementation of the accurate and domain-agnostic TSS algorithm ClaSP.

## Installation
You can install ClaSPy with PyPi: 
`python -m pip install claspy` 

## Usage

Let's first import the ClaSP algorithm and TS data from the <a href="https://github.com/ermshaua/time-series-segmentation-benchmark" target="_blank">"Time Series Segmentation Benchmark"</a> (TSSB) to demonstrate its utility.

```python3
>>> from claspy.segmentation import BinaryClaSPSegmentation
>>> from claspy.data_loader import load_tssb_dataset
```

As an example, we choose the <a href="http://timeseriesclassification.com/description.php?Dataset=Cricket" target="_blank">Cricket</a> data set that contains motions of different umpire signals caputured as wrist acceleration. ClaSP should automatically detect semantic changes between signals and deduce their segmentation. It is parameter-free, so we just need to pass the time series as a numpy array.

```python3
>>> dataset, window_size, true_cps, time_series = load_tssb_dataset(names=("CricketX",)).iloc[0,:]
>>> clasp = BinaryClaSPSegmentation()
>>> clasp.fit_predict(time_series)
[ 712 1281 1933 2581]
```

ClaSP is fully interpretable to human inspection. It creates a score profile (between 0 and 1) that estimates the probability of a "change point" in a TS, where one segment transitions into another. We visualize the segmentation and compare it to the pre-defined human annotation.

```python3
clasp.plot(gt_cps=true_cps, heading="Segmentation of different umpire cricket signals", ts_name="ACC", file_path="segmentation_example.png")
```

<img src="https://raw.githubusercontent.com/ermshaua/claspy/main/segmentation_example.png" />

ClaSP accurately detects the number and location of changes in the motion sequence (compare green vs red lines) that infer its segmentation (the different-coloured subsequences). It is carefully designed to do this fully autonomously. However, if you have domain-specific knowledge, you can utilize it to guide and improve the segmentation. See its <a href="https://github.com/ermshaua/claspy/blob/main/claspy/segmentation.py">parameters</a> for more information.

## Examples

Checkout the following Jupyter notebooks that show applications of the ClaSPy package:

- <a href="https://github.com/ermshaua/claspy/blob/main/claspy/notebooks/tssb_evaluation.ipynb">ClaSP evaluation on the "Time Series Segmentation Benchmark" (TSSB)</a>
- <a href="https://github.com/ermshaua/claspy/blob/main/claspy/notebooks/clasp_configuration.ipynb">Hyper-parameter Tuning and Configuration of ClaSP</a>
- <a href="https://github.com/ermshaua/claspy/blob/main/claspy/notebooks/window_size_selection.ipynb">Window Size Selection for Unsupervised Time Series Analytics</a>

## Citation

The ClaSPy package is actively maintained, updated and intended for application. If you use ClaSP in your scientific publication, we would appreciate the following <a href="https://doi.org/10.1007/s10618-023-00923-x" target="_blank">citation</a>:

```
@article{clasp2023,
  title={ClaSP: parameter-free time series segmentation},
  author={Arik Ermshaus and Patrick Sch{\"a}fer and Ulf Leser},
  journal={Data Mining and Knowledge Discovery},
  year={2023},
}
```

## Todos

Here are some of the things we would like to add to ClaSPy in the future:

- Future research related to ClaSP
- Example and application Jupyter notebooks
- More documentation and tests 

If you want to contribute, report bugs, or need help applying ClaSP for your application, feel free to reach out.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ermshaua/claspy",
    "name": "claspy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<3.12",
    "maintainer_email": "",
    "keywords": "machine-learning,time-series,unsupervised-learning,segmentation,change-points",
    "author": "Arik Ermshaus",
    "author_email": "Arik Ermshaus <ermshaua@informatik.hu-berlin.de>",
    "download_url": "https://files.pythonhosted.org/packages/5d/c3/8e7be853a970b03244a832efc4d0969c381d68a12d9daaaca7bc27287fc9/claspy-0.2.2.tar.gz",
    "platform": null,
    "description": "# ClaSPy: A Python package for time series segmentation\n[![PyPI version](https://badge.fury.io/py/claspy.svg)](https://pypi.org/project/claspy/) [![Downloads](https://pepy.tech/badge/claspy)](https://pepy.tech/project/claspy)\n\nTime series segmentation (TSS) tries to partition a time series (TS) into semantically meaningful segments. It's an important unsupervised learning task applied to large, real-world sensor signals for human inspection, change point detection or as preprocessing for classification and anomaly detection. This python library is the official implementation of the accurate and domain-agnostic TSS algorithm ClaSP.\n\n## Installation\nYou can install ClaSPy with PyPi: \n`python -m pip install claspy` \n\n## Usage\n\nLet's first import the ClaSP algorithm and TS data from the <a href=\"https://github.com/ermshaua/time-series-segmentation-benchmark\" target=\"_blank\">\"Time Series Segmentation Benchmark\"</a> (TSSB) to demonstrate its utility.\n\n```python3\n>>> from claspy.segmentation import BinaryClaSPSegmentation\n>>> from claspy.data_loader import load_tssb_dataset\n```\n\nAs an example, we choose the <a href=\"http://timeseriesclassification.com/description.php?Dataset=Cricket\" target=\"_blank\">Cricket</a> data set that contains motions of different umpire signals caputured as wrist acceleration. ClaSP should automatically detect semantic changes between signals and deduce their segmentation. It is parameter-free, so we just need to pass the time series as a numpy array.\n\n```python3\n>>> dataset, window_size, true_cps, time_series = load_tssb_dataset(names=(\"CricketX\",)).iloc[0,:]\n>>> clasp = BinaryClaSPSegmentation()\n>>> clasp.fit_predict(time_series)\n[ 712 1281 1933 2581]\n```\n\nClaSP is fully interpretable to human inspection. It creates a score profile (between 0 and 1) that estimates the probability of a \"change point\" in a TS, where one segment transitions into another. We visualize the segmentation and compare it to the pre-defined human annotation.\n\n```python3\nclasp.plot(gt_cps=true_cps, heading=\"Segmentation of different umpire cricket signals\", ts_name=\"ACC\", file_path=\"segmentation_example.png\")\n```\n\n<img src=\"https://raw.githubusercontent.com/ermshaua/claspy/main/segmentation_example.png\" />\n\nClaSP accurately detects the number and location of changes in the motion sequence (compare green vs red lines) that infer its segmentation (the different-coloured subsequences). It is carefully designed to do this fully autonomously. However, if you have domain-specific knowledge, you can utilize it to guide and improve the segmentation. See its <a href=\"https://github.com/ermshaua/claspy/blob/main/claspy/segmentation.py\">parameters</a> for more information.\n\n## Examples\n\nCheckout the following Jupyter notebooks that show applications of the ClaSPy package:\n\n- <a href=\"https://github.com/ermshaua/claspy/blob/main/claspy/notebooks/tssb_evaluation.ipynb\">ClaSP evaluation on the \"Time Series Segmentation Benchmark\" (TSSB)</a>\n- <a href=\"https://github.com/ermshaua/claspy/blob/main/claspy/notebooks/clasp_configuration.ipynb\">Hyper-parameter Tuning and Configuration of ClaSP</a>\n- <a href=\"https://github.com/ermshaua/claspy/blob/main/claspy/notebooks/window_size_selection.ipynb\">Window Size Selection for Unsupervised Time Series Analytics</a>\n\n## Citation\n\nThe ClaSPy package is actively maintained, updated and intended for application. If you use ClaSP in your scientific publication, we would appreciate the following <a href=\"https://doi.org/10.1007/s10618-023-00923-x\" target=\"_blank\">citation</a>:\n\n```\n@article{clasp2023,\n  title={ClaSP: parameter-free time series segmentation},\n  author={Arik Ermshaus and Patrick Sch{\\\"a}fer and Ulf Leser},\n  journal={Data Mining and Knowledge Discovery},\n  year={2023},\n}\n```\n\n## Todos\n\nHere are some of the things we would like to add to ClaSPy in the future:\n\n- Future research related to ClaSP\n- Example and application Jupyter notebooks\n- More documentation and tests \n\nIf you want to contribute, report bugs, or need help applying ClaSP for your application, feel free to reach out.\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2023, Arik Ermshaus  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "",
    "version": "0.2.2",
    "project_urls": {
        "Homepage": "https://github.com/ermshaua/claspy",
        "repository": "https://github.com/ermshaua/claspy"
    },
    "split_keywords": [
        "machine-learning",
        "time-series",
        "unsupervised-learning",
        "segmentation",
        "change-points"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e2b05eed7a68907fbac7d195d844a62e357fa0e4ebe262c36b35350dc41f06a4",
                "md5": "3f4e9bf06d0fd164e1a7ad91d7965f7d",
                "sha256": "df5bb4586aa635915a26e01b227d87014056667bdaa31fe24fc730e9155392b9"
            },
            "downloads": -1,
            "filename": "claspy-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f4e9bf06d0fd164e1a7ad91d7965f7d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<3.12",
            "size": 33693,
            "upload_time": "2024-01-10T13:32:23",
            "upload_time_iso_8601": "2024-01-10T13:32:23.272701Z",
            "url": "https://files.pythonhosted.org/packages/e2/b0/5eed7a68907fbac7d195d844a62e357fa0e4ebe262c36b35350dc41f06a4/claspy-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5dc38e7be853a970b03244a832efc4d0969c381d68a12d9daaaca7bc27287fc9",
                "md5": "a2e71955354ed9091f7c7bc50bf9f65c",
                "sha256": "e923f7c762a41af322ede68258ce40c185459530c3d89bdebbdc878e867e68a9"
            },
            "downloads": -1,
            "filename": "claspy-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a2e71955354ed9091f7c7bc50bf9f65c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<3.12",
            "size": 30555,
            "upload_time": "2024-01-10T13:32:25",
            "upload_time_iso_8601": "2024-01-10T13:32:25.925261Z",
            "url": "https://files.pythonhosted.org/packages/5d/c3/8e7be853a970b03244a832efc4d0969c381d68a12d9daaaca7bc27287fc9/claspy-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-10 13:32:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ermshaua",
    "github_project": "claspy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "claspy"
}
        
Elapsed time: 0.16657s