Skip to main content

Sktime-compatible change and anomaly detection

Project description

skchange

codecov tests docs BSD 3-clause !black Python PyPI Downloads

Breaking changes expected. skchange is undergoing a significant API redesign in upcoming releases. See Issue #120 for more details. If you need stability and the old sktime compatibility, pin to a specific version:

pip install "skchange==0.14.3"

Documentation

Installation

It is recommended to install skchange with numba for faster performance:

pip install skchange[numba]

Alternatively, you can install skchange without numba:

pip install skchange

Quickstart

Changepoint detection / time series segmentation

from skchange.change_detectors import MovingWindow
from skchange.datasets import generate_piecewise_normal_data

df = generate_piecewise_normal_data(
    means=[0, 5, 10, 5, 0],
    lengths=[50, 50, 50, 50, 50],
    seed=1,
)

detector = MovingWindow(bandwidth=20)
detector.fit_predict(df)
   ilocs
0     50
1    100
2    150
3    200

Multivariate anomaly detection with variable identification

from skchange.anomaly_detectors import CAPA
from skchange.anomaly_scores import L2Saving
from skchange.compose.penalised_score import PenalisedScore
from skchange.datasets import generate_piecewise_normal_data
from skchange.penalties import make_linear_chi2_penalty

df = generate_piecewise_normal_data(
    means=[0, 8, 0, 5],
    lengths=[100, 20, 130, 50],
    proportion_affected=[1.0, 0.1, 1.0, 0.5],
    n_variables=10,
    seed=1,
)

score = L2Saving()  # Looks for segments with non-zero means.
penalty = make_linear_chi2_penalty(score.get_model_size(1), df.shape[0], df.shape[1])
penalised_score = PenalisedScore(score, penalty)
detector = CAPA(penalised_score, find_affected_components=True)
detector.fit_predict(df)
        ilocs  labels         icolumns
0  [100, 120)       1              [0]
1  [250, 300)       2  [2, 0, 3, 1, 4]

License

skchange is a free and open-source software licensed under the BSD 3-clause license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skchange-0.15.0.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skchange-0.15.0-py3-none-any.whl (2.5 MB view details)

Uploaded Python 3

File details

Details for the file skchange-0.15.0.tar.gz.

File metadata

  • Download URL: skchange-0.15.0.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for skchange-0.15.0.tar.gz
Algorithm Hash digest
SHA256 38cc2fb7910f9cd115b5be1d9978fc0b28a3033713670fb06a2074df3461d5fc
MD5 d4e79c6bbe46ff958575119c1d0c3e2a
BLAKE2b-256 bdedfa8c97aebf8529ffaebdb661c75a778d8c247ffcf3b605880a9fdcc8b80f

See more details on using hashes here.

File details

Details for the file skchange-0.15.0-py3-none-any.whl.

File metadata

  • Download URL: skchange-0.15.0-py3-none-any.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for skchange-0.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af45d7f28036339983523d6be29df3e54223a20f71171cb7b8a0e9932ee31a7e
MD5 292a8c6ab3096b4129c31d43c8d1e956
BLAKE2b-256 56769e1d2522582eecc0208d57a501e0683ca933174f16ccc4ba800d61025cfe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page