gridcp: Fast Online Changepoint Detection in Python
Per August Jarval Moen, Sebastian Grau Nielsen, Espen Bjørge Urheim, Martin Tveten, Ingrid Kristine Glad
Abstract
Online changepoint detection is the problem of detecting distributional changes in a data stream in real-time. A large body of methodology exists for the offline (fixed-size) setting, but applying these methods online quickly becomes infeasible since the per-observation computational cost and memory consumption typically grow at least linearly with the sample size. A recently proposed grid-based methodology (Moen, 2026) overcomes this by evaluating an offline test statistic over a sparse geometric grid of split points, with grid points spaced increasingly far apart further in the past. For a wide class of test statistics, this approach keeps update time and memory consumption growing logarithmic in the length of the data stream, while admitting finite-sample guarantees on the detection delay. Building on this methodology, we present gridcp, an open-source Python package that turns offline changepoint tests into efficient online detectors through a single, uniform interface. Users can choose from nine Numba-accelerated built-in tests, spanning changes in the mean, variance, covariance, and regression coefficients, as well as nonparametric tests and generalized likelihood-ratio tests for exponential-family models. Users can also supply their own test, which the package handles identically. For any test, gridcp provides Monte Carlo routines that calibrate the detection threshold to a target false alarm probability or average run length, including data-driven variants when no parametric null model is available. Through simulations and three real-data case studies, we show that calibration is accurate, that runtime scales favorably with both stream length and dimension, and that the complete pipeline, from calibration to deployment, runs efficiently on long real-world streams with only a short detection delay.
Create a lesson
Related papers
RECaST-Surv: A Calibrated Borrowing Method for Survival Endpoints in Unequal Randomized Trials
Dehua Bi, Arlina Shen, Ruben P. A. van Eijk et al.
Beyond Pretrends: A Discordance-Based Sensitivity Analysis for Difference-in-Differences
Thomas Leavitt
Earth and space observations meet complex algebras: from complex to octonions for multivariate autoregressive time series analysis
Susana Eyheramendy, Felipe Elorrieta, Wilfredo Palma et al.
Efficient transport and generalization of survival treatment effects
Axel Martin, Iván Díaz, Michele Santacatterina
A new tractable Archimedean copula for full-range tail dependence
Lei Hua
Doubly valid and doubly sharp sensitivity analysis to unobserved confounding for survival outcomes
Jean-Baptiste Baitairian, Bernard Sebastien, Rana Jreich et al.