Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

giobbu/CUSUM

Open more actions menu

Repository files navigation

Python 3.11+ Documentation Status pytest codecov Status DOI

CUSUM

Made with Love

The CUSUM repository contains multiple change point detectors for sequential analysis, enabling the detection of changes in the statistical properties of time-ordered or streaming data.

Table of Contents

  1. Overview
  2. CUSUM Detectors
  3. Getting Started
  4. Documentation
  5. Examples
  6. License

0. Overview

A change point is a point in time at which the statistical properties of a target variable—or its underlying data-generating process—undergo a significant shift. Detecting such changes is critical in domains such as finance, energy markets, healthcare, environmental monitoring, industrial processes, and online advertising. In these settings, predictive models and decision-making systems must adapt continuously to non-stationary and evolving conditions.

This project implements multiple variants of the CUSUM algorithm for change point detection, enabling robust identification of distributional shifts in sequential data.

1. CUSUM Detectors

CUSUM-based detectors are sequential algorithms designed to identify shifts in time-ordered or streaming data. They operate by incrementally processing observations—either instance by instance or in batches—and signaling a change when accumulated evidence indicates a statistically significant deviation from the expected behavior.

The implemented detectors support both:

  • Batch-based detection, where change points are identified over fixed-size windows or data batches

  • Instance-based detection, where each incoming observation is evaluated upon arrival

These detectors are, therefore, well suitable for both offline analysis and real-time monitoring in streaming environmnets.

2. Getting Started

Clone the repository:

git clone https://github.com/giobbu/CUSUM.git
cd CUSUM

Using Makefile (Recommended)

The repository includes a Makefile for easy setup and common tasks:

# Install dependencies using uv sync
make install

# Run tests with coverage
make test

# Upgrade a specific package
make upgrade PACKAGE=<package-name>

# View all available commands
make help

Manual Setup

Alternatively, set up manually using uv:

# Install dependencies
uv sync

# Run tests
pytest --cov=source test/

3. Documentation

Documentation is available at CUSUM Documentation

4. Examples

A. Probabilistic CUSUM detector

View details on docs - Here

Image Alt Text

B. RLS-CUSUM for streaming monitoring

RLS-CUSUM based Monitoring with an instance-based linear learning model and the CUSUM detector.

Image Alt Text

At each time step:

  • Generate a prediction with recursive least squares (RLS) model;
  • Acquire the true observed value;
  • Compute residual;
  • Apply the CUSUM detector on the residuals to identify potential change points;
  • Update the model parameters with the new data instance.

View details on notebook - Here

Image Alt Text

C. CUSUM-Ops

  • Event-based CUSUM detection with Kafka, Prometheus and Grafana in mlops-kafka
  • Scheduled CUSUM detection with Kubernetes CronJob and minikube local cluster in mlops-cronjob

5. License

This project is under the GPL-3.0 license.

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.