NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

fastcpd: Fast Change Point Detection via Sequential Gradient Descent

Xingchi Li, Xianyang ZhangOpenalex Unknown 2023 · OpenAlex

Abstract

The fastcpd package implements a high-performance change point detection algorithm based on the research "Sequential Gradient Descent and Quasi-Newton's Method for Change-Point Analysis" by Xianyang Zhang and Trisha Dawn (https://proceedings.mlr.press/v206/zhang23b.html). By combining dynamic programming with pruning and sequential gradient descent (SeGD), the package achieves detection speeds significantly faster than traditional methods like Pruned Exact Linear Time (PELT). It supports a wide range of models, including linear, logistic, and Poisson regressions, as well as complex time-series and custom cost functions.

Introduction

Change point detection (CPD) is a critical task in statistical analysis, aimed at identifying moments when the underlying properties of a data sequence undergo structural shifts. This is vital in fields such as finance, genomics, and engineering. However, exact detection methods like PELT often face computational bottlenecks because they require solving an optimization problem for every possible data segment. As datasets grow in size ($T$) and complexity ($p$), these methods become prohibitively slow.

The fastcpd package addresses this challenge by introducing a framework that bridges the gap between computational efficiency and statistical flexibility. It allows for the identification of structural breaks in complex models at scale without the heavy computational tax of exact minimization.

Methodology

The core of fastcpd is the integration of Sequential Gradient Descent (SeGD) and Quasi-Newton methods into a dynamic programming framework.

Sequential Gradient Descent (SeGD)

Instead of performing global cost minimization for every segment, fastcpd utilizes gradient-based updates to approximate the cost. This shift from exact optimization to iterative approximation significantly reduces the per-step computational complexity.

Hybrid Approach and Warm Starting

To ensure stability, the package employs a hybrid approach. For very short segments where gradients might be unstable, the algorithm can perform exact minimization (controlled by the vanilla_percentage parameter). As segments grow, it transitions to SeGD. Additionally, the algorithm supports "warm starting," using parameter estimates from previous segments to accelerate convergence in the current segment.

Pruning and Efficiency

Similar to the PELT algorithm, fastcpd uses pruning techniques to discard candidate change points that are statistically unlikely to be optimal. This keeps the search space near-linear relative to the data size ($O(T)$), avoiding the quadratic complexity of naive dynamic programming.

Supported Models and Datasets

The package is highly flexible, supporting a variety of model "families":

  • Regression Models: Linear (LM), Generalized Linear Models (GLM like Poisson and Binomial), and Lasso for penalized regression.
  • Time Series: AR, ARMA, ARIMA, GARCH, and VAR models.
  • Custom Functions: Users can define custom cost functions in C++ via Rcpp for specialized applications.

The utility of fastcpd is demonstrated across several benchmark datasets:

  • Bitcoin Market Price: Detecting shifts in volatility and mean price (2019–2023).
  • Occupancy Detection: Identifying room occupancy based on environmental sensors.
  • Transcriptome Analysis: Analyzing human bladder carcinoma samples.
  • UK Seatbelts Data: Evaluating the impact of seatbelt legislation on road casualties.
  • Well-log Data: A standard benchmark for nuclear magnetic resonance measurements.

Key Results and Insights

The primary advantage of fastcpd is its speed. It is approximately an order of magnitude faster than vanilla PELT, particularly as the number of parameters or the length of the time series increases. This efficiency is achieved because gradient-based approximations are "good enough" to maintain detection accuracy while providing massive speedups.

Furthermore, the package's implementation in optimized C++ (via Rcpp, RcppArmadillo, and RcppEigen) makes it suitable for "big data" applications within the R environment. Unlike many existing packages that focus solely on mean-shift detection, fastcpd can identify changes in variances, regression coefficients, and autoregressive parameters.

Limitations

While powerful, fastcpd requires careful parameter tuning, specifically regarding the penalty term ($\beta$). Although it defaults to the Modified Bayesian Information Criterion (mBIC), noise profiles may necessitate manual adjustment. Additionally, the reliance on SeGD means performance is sensitive to the "well-behavedness" of the cost function; highly non-convex or poorly scaled loss functions may require tuning of momentum or line search parameters. Finally, while it supports Lasso, extremely high-dimensional settings ($p \gg T$) remain a general challenge for CPD algorithms.

Summary updated

BibTeX
@inproceedings{li2023fastcpd,
  author = {Xingchi Li and Xianyang Zhang},
  title = {{fastcpd: Fast Change Point Detection via Sequential Gradient Descent}},
  booktitle = {Openalex Unknown},
  year = {2023},
  doi = {10.32614/cran.package.fastcpd},
}

Loading related content...

Figure