When does a stream change? The cumulative sum control scheme carries a single accumulator that adds each deviation from a target and clamps at zero: S ← max(0, S + (x−target)). While the process behaves, deviations cancel and S hovers near zero; when a real shift begins, deviations pile up in one direction and S climbs past a threshold — alarm. It is optimal in the sense of detecting a persistent shift as fast as possible for a given false-alarm rate. One number of state, no window, no history — a change detector whose memory of the past is entirely folded into a single running sum.
A stream that shifts upward. The demo accumulates the deviations and fires when the running sum crosses the threshold: live demo
“Detecting a change means comparing windows of history.” — CUSUM folds all the evidence into one accumulator; it fires the moment the drift outweighs the noise, with a single number of memory. cited
Evidence banked, noise cancelled, the alarm tripped when drift outweighs chance. A whole history's worth of watching, in one running sum. Page 1954
On the canonical compiler, a stream of upward deviations trips the CUSUM at step 3 once the running sum crosses the threshold: