Change point detection, also written changepoint detection, is the task of identifying the times at which the statistical behavior of a sequence changes, for example when its mean, variance, trend, frequency content or correlation structure shifts to a new regime. Anomaly detection treats it as a distinct problem from spotting isolated outliers: a change point marks a persistent transition, after which the data follows a different distribution rather than returning to normal.
Methods fall into two broad families. Offline (retrospective) detection analyzes a complete series to segment it as accurately as possible, while online (sequential) detection processes observations as they arrive and must raise an alarm quickly while keeping false alarms rare. Both appear across monitoring, finance, climate science, genomics and industrial quality control.
How change point detection works
Most methods compare the data before and after a candidate time and ask whether two segments are better explained by different models than by one. Formally, a series y₁ to yₙ is split into segments by change points τ₁ to τₖ, and each segment is assumed to follow its own distribution or parameter set.
Offline approaches usually minimize a penalized cost: the sum of a segment cost, such as the negative log-likelihood or the squared error around the segment mean, plus a penalty for each additional change point. The penalty prevents overfitting, because without it every observation could become its own segment. Common choices are the BIC penalty of about p·log n per change and data-driven calibration.
Online approaches maintain a running test statistic that grows when recent data looks inconsistent with the current regime, and they signal a change when the statistic crosses a decision threshold.
The table below lists the types of change that detectors are designed to find.
| Type of change | What shifts | Typical example |
|---|---|---|
| Mean shift | Average level | Server latency rises after a deployment |
| Variance change | Spread or volatility | Market volatility jumps during a crisis |
| Trend change | Slope of a linear trend | User growth slows after a price change |
| Frequency change | Periodicity or spectrum | Machine vibration gains a new harmonic |
| Correlation change | Dependence between variables | Two sensors stop moving together |
| Distribution change | Overall shape of the data | Transaction amounts become heavy-tailed |
Main algorithms and their trade-offs
Algorithms differ in search strategy, statistical assumptions and computational cost. Classical sequential tests such as CUSUM and the Page-Hinkley test accumulate evidence of a shift and are cheap enough for streaming data. For segmentation, PELT (pruned exact linear time) finds the exact optimum of a penalized cost and runs in near-linear time under mild conditions, while binary segmentation is faster but only approximate.
Bayesian online change point detection (BOCPD) tracks a probability distribution over the current run length, the time since the last change, and outputs calibrated uncertainty. Kernel methods and neural approaches relax distributional assumptions at a higher computational price.
| Algorithm | Mode | Main assumption | Cost |
|---|---|---|---|
| CUSUM | Online | Known pre-change and post-change models | O(1) per point |
| Page-Hinkley | Online | Shift in the mean | O(1) per point |
| BOCPD | Online | Conjugate model per segment | O(n) per point without pruning |
| Binary segmentation | Offline | Changes found one at a time | O(n log n) |
| PELT | Offline | Additive segment cost and penalty | Near O(n) in practice |
| Kernel change point | Offline | Changes in a kernel feature space | O(n²) or more |
Relation to anomaly detection and drift
Change point detection overlaps with several neighboring tasks, and confusing them leads to wrong method choices. A point anomaly is a single unusual observation; a collective anomaly is a short unusual subsequence that ends; a change point begins a lasting new regime. In machine learning operations, a closely related idea is concept drift, where the relationship between inputs and labels changes and a deployed model degrades.
| Phenomenon | Duration | Typical response |
|---|---|---|
| Point anomaly | One observation | Investigate or discard the value |
| Collective anomaly | Short, then returns to normal | Inspect the episode |
| Change point | Persistent after onset | Update baselines or retrain models |
| Gradual drift | Slow continuous shift | Monitor windows and recalibrate |
In practice, a forecasting-based anomaly detector often benefits from a change point detector running beside it: when a genuine level shift occurs, the forecast baseline should be reset rather than flagged indefinitely, otherwise every later point appears anomalous.
Evaluating and tuning a detector
Online detectors face a fundamental trade-off between detection delay and the false alarm rate, usually expressed as the average run length before a false alarm. Raising the threshold makes alarms rarer but slower. Offline methods are evaluated by how closely estimated change points match annotated ones within a tolerance margin, using precision, recall, the F1 score or the Hausdorff distance.
| Setting | If increased | If decreased |
|---|---|---|
| Penalty or threshold | Fewer, more reliable change points | More changes, more false positives |
| Minimum segment length | Short regimes are missed | Spurious short segments appear |
| Window size | Stable estimates, slower reaction | Faster reaction, noisier estimates |
| Tolerance margin | Evaluation becomes lenient | Evaluation demands exact timing |
Common pitfalls in practice
Real data rarely satisfies textbook assumptions, and violated assumptions are the main source of errors.
- Seasonality creates apparent changes every day or week unless it is removed or modeled first.
- Autocorrelation inflates test statistics, so methods that assume independent noise report too many changes.
- Outliers can masquerade as short segments when the cost function is not robust.
- Default penalties tuned on one dataset seldom transfer to another with different noise levels.
- Multivariate series need methods that model joint changes, not separate univariate tests on each variable.
Understanding it simply
Think of a heart rate monitor during a run. While you jog, the number hovers around one level. When you start sprinting, it climbs and stays higher. Change point detection finds that moment of switching. It does not care about one odd reading. It looks for the point where the whole pattern settles into something new.
Some tools study the full recording afterward and mark every switch. Others watch live and sound an alert as soon as they are fairly sure. The live version must balance speed against false alarms.
Applied in practice
An operations team monitors the 95th percentile response time of a web service, sampled every minute. Normal values sit near 180 milliseconds with a daily pattern. The team removes the daily seasonality and feeds the residuals into a CUSUM detector with a threshold calibrated for roughly one false alarm per month.
After a routine release, latency rises to about 230 milliseconds and stays there. The detector signals a change point eleven minutes after the deployment, while the existing outlier alerts stay silent because no single value looks extreme. Engineers trace the shift to a missing database index and roll back. An offline PELT analysis of the previous quarter later reveals three similar silent regressions, which leads the team to add the detector to every release pipeline.