Welcome to skchange#

A python library for fast change point and segment anomaly detection. The library is designed to be compatible with sktime. Numba is used for computational speed.

!New!#

Notebook tutorial from PyData Global 2024 available in the User guide.

Installation#

The library can be installed via pip:

pip install skchange

Requires python versions >= 3.9, < 3.14.

For better computational performance, it is recommended to install skchange with numba:

pip install skchange[numba]

Key features#

  • Fast: Numba is used for performance.

  • Easy to use: Follows the conventions of sktime and scikit-learn.

  • Easy to extend: Make your own detectors by inheriting from the base class templates. Create custom detection scores and cost functions.

  • Segment anomaly detection: Detect intervals of anomalous behaviour in time series data.

  • Subset anomaly detection: Detect intervals of anomalous behaviour in time series data, and infer the subset of variables that are responsible for the anomaly.

Mission#

The goal of skchange is to provide a library for fast and easy-to-use changepoint-based algorithms for change and anomaly detection. The primary focus is on modern methods in the statistical literature.

Example#

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)
        ilocs  labels   icolumns
0  [100, 120)       1        [0]
1  [250, 300)       2  [2, 1, 0]

Licence#

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