Algorithm Search⌘K

Problemcore

Change-point detection

Also called change-point problem, structural break detection.

Find the times at which the distribution of a sequence changes, offline from a whole series or online with a small delay and few false alarms.

Change-point detection asks at which times the distribution of a sequence of observations changes. In the offline version the whole series is available, and the task is to split it into segments that each look homogeneous: the number and the places of the changes are both unknown. In the online version, also called quickest detection, the data arrive one at a time, and the task is to raise an alarm soon after a change while raising few false alarms before it. Both versions are built on the likelihood of a segmented model. The offline problem with a penalty per change has an exact O(n2)O(n^2) dynamic program, and the PELT algorithm often makes it linear; the online problem has the CUSUM procedure, which is optimal in a precise sense, and the Bayesian online changepoint detector.

In plain words

A machine fills bottles. One day a part wears and the bottles start to come out a little too light. Each bottle varies anyway, so one light bottle proves nothing. The question is when the pattern changed. If you have the whole record, you can look back and split it into calm stretches, each with its own average, and ask where the splits best explain the data. Each extra split must earn its place, or you would split the record at every bottle. If you watch the line as it runs, you want an alarm soon after the change. But every alarm stops the line, so false alarms cost money. Both problems trade one error against another: too many splits against too few, or a late alarm against a false one.

Definition

Offline, penalized form. Given observations y1,…,yny_1, \ldots, y_n, a segment cost C(ys+1..t)\mathcal C(y_{s+1..t}), usually twice the negative maximized log-likelihood of the segment, and a penalty β>0\beta > 0, find a number of changes m≥0m \ge 0 and change points 0=τ0<τ1<⋯<τm<τm+1=n0 = \tau_0 < \tau_1 < \cdots < \tau_m < \tau_{m+1} = n that minimize

∑j=0mC(yτj+1..τj+1)+βm.\sum_{j=0}^{m} \mathcal C\bigl(y_{\tau_j+1..\tau_{j+1}}\bigr) + \beta m.

The change point τj\tau_j is the last index of a segment. For a change in the mean of normal data with known variance σ2=1\sigma^2 = 1, C\mathcal C is the residual sum of squares of the segment about its own mean, and a common default is β=2log⁡n\beta = 2\log n, a BIC-type penalty.

Offline, constrained form. Given mm, minimize the total cost over the placements of exactly mm change points. Solving it for every mm up to mmax⁡m_{\max} and choosing mm by a criterion is the segment neighbourhood approach.

Online, quickest detection. Observations X1,X2,…X_1, X_2, \ldots have density f0f_0 before an unknown change time ν\nu and density f1f_1 from time ν\nu on. A detection rule is a stopping time TT. Write PνP_\nu for the law with change at ν\nu and P∞P_\infty for no change. The usual minimax criteria are:

  • the false alarm constraint E∞[T]≥γE_\infty[T] \ge \gamma, the average run length to a false alarm;
  • Lorden's worst-case delay dˉ(T)=sup⁡ν≥1ess sup⁡Eν[(T−ν+1)+∣X1,…,Xν−1]\bar d(T) = \sup_{\nu \ge 1}\operatorname{ess\,sup} E_\nu\bigl[(T - \nu + 1)^+ \mid X_1, \ldots, X_{\nu-1}\bigr];
  • Pollak's delay sup⁡ν≥1Eν[T−ν∣T≥ν]\sup_{\nu \ge 1} E_\nu[T - \nu \mid T \ge \nu].

The task is to minimize the delay subject to the false alarm constraint. In the Bayesian form, ν\nu has a prior, often geometric, and the task is to minimize P(T<ν)+c E[(T−ν)+]P(T < \nu) + c\,E[(T - \nu)^+].

Variants

  • What changes. The mean, the variance, both, the slope of a trend, the parameters of an autoregressive model, the whole distribution (nonparametric costs based on ranks or empirical distribution functions), or the covariance of a multivariate series.
  • Known or unknown parameters. In quality control the in-control law f0f_0 is often known, and the post-change law is a planned shift. In segmentation both are usually unknown and estimated per segment.
  • One change or many. The at-most-one-change problem is a test of "no change" against "one change at an unknown time", with a maximum over the change time; many changes need a search over segmentations.
  • Offline, online, or online with a window. Online methods may also look back over a finite window, which bounds their memory.
  • Bayesian. A product partition model puts a prior on the segmentation and computes posterior probabilities of change points, online or offline.
  • Epidemic changes. The parameter changes and later changes back, as in a burst; this is two changes with a constraint.

Examples

Offline, a mean shift with a penalty. For y=(1,0,1,5,6,5,6,1,0)y = (1, 0, 1, 5, 6, 5, 6, 1, 0), the RSS cost and β=4\beta = 4, the best segmentation with each number of changes mm is:

mm best change points best total RSS RSS +4m+ 4m
0 none 55.56 55.56
1 3 35.50 39.50
2 3, 7 2.17 10.17
3 3, 7, 8 1.67 13.67
4 3, 4, 7, 8 1.33 17.33

The penalized optimum has the two changes at 3 and 7, the segments (1,0,1)(1, 0, 1), (5,6,5,6)(5, 6, 5, 6) and (1,0)(1, 0). A third change lowers the RSS by only 0.5, less than the penalty. The PELT page computes this answer step by step.

Offline, a short burst. Fifty zeros, then four values of 3, then fifty zeros. A single split anywhere explains little, because a burst in the middle needs two changes at once, so binary segmentation with a standard threshold finds nothing, while PELT and wild binary segmentation find the changes at 50 and 54.

Online, a mean shift. In-control data are N(0,1)N(0, 1) and the shift is to N(1,1)N(1, 1). The CUSUM with threshold hh has, in simulation, an average run length to a false alarm of 121.7 for h=3h = 3 and 913.7 for h=5h = 5, with average delays after a change at the start of 6.28 and 10.29 observations. The CUSUM page shows how the delay grows like log⁡(false alarm run length)\log(\text{false alarm run length}).

Online, Bayesian. For the data 0.2,−0.5,0.4,3.9,4.3,3.60.2, -0.5, 0.4, 3.9, 4.3, 3.6 with known noise, the Bayesian online changepoint detector gives posterior probability 0.80 that a change happened just before the fourth value, as soon as that value arrives.

Known algorithms

algorithm setting guarantee cost
optimal partitioning (segmented least squares) offline, penalized exact O(n2)O(n^2) cost evaluations
segment neighbourhood (Auger and Lawrence 1989) offline, mm changes exact for each m≤mmax⁡m \le m_{\max} O(mmax⁡n2)O(m_{\max} n^2)
PELT offline, penalized exact O(n2)O(n^2) worst case, close to O(n)O(n) when changes are frequent
FPOP (Maidstone et al. 2017) offline, penalized, one-parameter costs exact close to O(nlog⁡n)O(n \log n) in practice
binary segmentation offline approximate, greedy O(n(m+1))O(n(m + 1)); O(nlog⁡n)O(n \log n) for balanced splits
wild binary segmentation (Fryzlewicz 2014) offline consistent under conditions O(nM)O(nM) for MM random intervals
CUSUM (Page 1954) online, known f0,f1f_0, f_1 optimal for Lorden's criterion O(1)O(1) per observation
Shiryaev-Roberts online near optimal for Pollak's criterion O(1)O(1) per observation
Bayesian online changepoint detection online, Bayesian exact posterior of the run length O(t)O(t) at time tt, less with pruning
hidden Markov model decoding offline or online, a finite set of regimes exact for the model O(nk2)O(nk^2) for kk states by the Viterbi or forward algorithm

For models with a continuous latent state that jumps, a Kalman filter with outlier and jump tests, or a particle filter, detects changes in a state space model.

AlgorithmTimeSpacePropertiesCode
Bayesian online change-point detectionΘ(n²) worstΘ(n) extradeterministicexactonlineiterative1 language
Binary segmentationΘ(n(m+1)) worstΘ(n) extradeterministicnot exactofflinerecursive1 language
CUSUMΘ(n) worstΘ(1) extradeterministiconlineoptimal for lorden criterioniterative1 language
PELTΘ(n²) worstΘ(n) extradeterministicexactofflineiterative1 language

Bounds

  • Offline, exact search. Any exact method for a general segment cost must, in the worst case, consider all O(n2)O(n^2) segments, and optimal partitioning does so with O(n2)O(n^2) cost evaluations. PELT and FPOP are exact as well; their gain depends on the data. Killick, Fearnhead and Eckley (2012) prove that PELT has expected cost O(n)O(n) when the number of changes grows linearly with nn, under conditions on the model; with no change, PELT prunes little and costs Θ(n2)\Theta(n^2).
  • Offline, estimation accuracy. For one change of size δ\delta in the mean of normal data with variance σ2\sigma^2, the error of the maximum likelihood estimate of the change time stays bounded in probability as nn grows, and its limit distribution depends only on δ/σ\delta/\sigma (Hinkley 1970).
  • Online, the delay lower bound. Lorden (1971) proved that every rule with E∞[T]≥γE_\infty[T] \ge \gamma has worst-case delay at least (1+o(1))log⁡γ/D(f1 ∥ f0)(1 + o(1))\log\gamma / D(f_1 \,\|\, f_0) as γ→∞\gamma \to \infty, where DD is the Kullback-Leibler divergence, and that the CUSUM attains it. Moustakides (1986) proved that the CUSUM is exactly optimal for Lorden's criterion at every γ\gamma. These results are cited, not proved, on this site.
  • Online, Pollak's criterion. Pollak (1985) proved that a randomized Shiryaev-Roberts procedure is optimal up to an additive o(1)o(1) term in the delay.

Reductions

  • To shortest paths. The penalized offline problem is a shortest path from node 0 to node nn in the acyclic graph with an edge s→ts \to t of weight C(ys+1..t)+β\mathcal C(y_{s+1..t}) + \beta for every s<ts < t. Optimal partitioning is this shortest path computed in order, and segmented least squares is the same recursion with a line fit as the cost.
  • To sequential tests. The CUSUM is a sequence of SPRTs with lower threshold 0, restarted each time one accepts "no change". Its statistic is the maximum over the change time of the log likelihood ratio.
  • To hidden Markov models. A segmentation with mm changes and a left-to-right chain of regimes is a hidden Markov model whose states can only advance; Viterbi decoding gives the most likely segmentation under the model.
  • To hypothesis tests. The at-most-one-change problem is a hypothesis test with a nuisance parameter that exists only under the alternative. The maximum of the likelihood ratio over the change time does not have the usual chi-square limit, so its critical values come from extreme value theory or simulation.

Applications

  • Quality control. CUSUM charts monitor production lines, laboratory assays and hospital outcomes.
  • Genomics. Segmenting DNA copy number along a chromosome finds gains and losses; circular binary segmentation (Olshen et al. 2004) was built for this.
  • Economics and finance. Structural breaks in regression relations, volatility regimes in returns.
  • Signals and systems. Fault detection in sensors and machines, segmentation of speech and of physiological signals, intrusion detection in networks.
  • Climate and environment. Breaks in temperature records caused by station moves or new instruments.

References

  1. E. S. Page, Continuous inspection schemes, Biometrika 41(1/2) (1954), the cumulative sum scheme for detecting a change in a production process, and its average run length
  2. G. Lorden, Procedures for reacting to a change in distribution, Annals of Mathematical Statistics 42(6) (1971), the worst-case detection delay criterion, the asymptotic lower bound log(gamma) / KL, and the asymptotic optimality of the CUSUM
  3. George V. Moustakides, Optimal stopping times for detecting changes in distributions, Annals of Statistics 14(4) (1986), the exact optimality of the CUSUM under Lorden's criterion
  4. Moshe Pollak, Optimal detection of a change in distribution, Annals of Statistics 13(1) (1985), the conditional average delay criterion and the near optimality of the randomized Shiryaev-Roberts procedure
  5. David V. Hinkley, Inference about the change-point in a sequence of random variables, Biometrika 57(1) (1970), the maximum likelihood estimate of a single change point and its asymptotic distribution
  6. R. Killick, P. Fearnhead and I. A. Eckley, Optimal detection of changepoints with a linear computational cost, Journal of the American Statistical Association 107(500) (2012), the penalized cost formulation of offline detection and the PELT algorithm
  7. Ivan E. Auger and Charles E. Lawrence, Algorithms for the optimal identification of segment neighborhoods, Bulletin of Mathematical Biology 51(1) (1989), the segment neighbourhood dynamic program for the best segmentation with a given number of changes
  8. Robert Maidstone, Toby Hocking, Guillem Rigaill and Paul Fearnhead, On optimal multiple changepoint algorithms for large data, Statistics and Computing 27(2) (2017), functional pruning (FPOP and SNIP) and its comparison with PELT
  9. Piotr Fryzlewicz, Wild binary segmentation for multiple change-point detection, Annals of Statistics 42(6) (2014), binary segmentation on random intervals and its consistency
  10. Adam B. Olshen, E. S. Venkatraman, Robert Lucito and Michael Wigler, Circular binary segmentation for the analysis of array-based DNA copy number data, Biostatistics 5(4) (2004), circular binary segmentation and its use for DNA copy number
  11. Charles Truong, Laurent Oudre and Nicolas Vayatis, Selective review of offline change point detection methods, Signal Processing 167 (2020), a survey of cost functions, search methods and penalties for offline detection
  12. Alexander Tartakovsky, Igor Nikiforov and Michèle Basseville, Sequential Analysis, Hypothesis Testing and Changepoint Detection, CRC Press, 2014, the chapters on quickest change detection (Bayesian and minimax formulations, CUSUM and Shiryaev-Roberts procedures)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a contract.yaml