Welcome to skchange#

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

Installation#

The library can be installed via pip:

pip install skchange

Requires python versions >= 3.9, < 3.13.

Key features#

  • Fast: Numba is used to implement all algorithms.

  • 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.

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

  • Subset collective 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, 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)
  anomaly_interval anomaly_columns
0       [100, 119]             [0]
1       [250, 299]       [2, 1, 0]

Licence#

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