Papers
Topics
Authors
Recent
Search
2000 character limit reached

Segmented Confidence Sequences for Anomaly Detection

Updated 3 July 2026
  • Segmented Confidence Sequences (SCS) is an online, unsupervised framework that uses data-driven segmentation to construct statistically principled confidence intervals in locally stationary segments.
  • It applies both Hoeffding-style and empirical standard deviation methods to adaptively set thresholds for anomaly detection while controlling for time-uniform Type I errors.
  • The framework improves reliability over fixed thresholds, as demonstrated by enhanced true positive rates in scenarios such as sensor monitoring and manufacturing process control.

Segmented Confidence Sequences (SCS) is an online, unsupervised framework devised for robust anomaly detection in nonstationary time series. SCS employs statistically principled confidence sequences within locally stationary segments, where the segmentation is data-driven and adapts to evolving regimes. The construction yields locally adaptive thresholds maintaining time-uniform Type I error control, thereby improving reliability over fixed or globally adaptive thresholds in the presence of regime shifts, concept drift, or multi-scale distributional changes (Li et al., 8 Aug 2025).

1. Definitions and Mathematical Framework

Let {x1,x2,…}\{x_1,x_2,\ldots\} denote a stream of real-valued anomaly-scores (such as reconstruction errors), indexed by t=1,2,…t=1,2,\ldots. Each xtx_t is assumed bounded: a≤xt≤ba \leq x_t \leq b. The timeline is partitioned into KK non-overlapping segments with breakpoints 0=τ0<τ1<τ2<⋯<τK=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty, so segment kk covers t∈(τk−1,τk]t\in(\tau_{k-1},\tau_k]. Within each segment kk, define the local sample mean xˉt(k)=St(k)/nt(k)\bar{x}_t^{(k)} = S_t^{(k)}/n_t^{(k)} where t=1,2,…t=1,2,\ldots0 and t=1,2,…t=1,2,\ldots1.

A confidence sequence (CS) for the (unknown) segment mean t=1,2,…t=1,2,\ldots2 is a sequence of intervals t=1,2,…t=1,2,\ldots3 constructed so that

t=1,2,…t=1,2,\ldots4

where t=1,2,…t=1,2,\ldots5 is the error allocated to segment t=1,2,…t=1,2,\ldots6, with t=1,2,…t=1,2,\ldots7. An anomaly at time t=1,2,…t=1,2,\ldots8 is flagged if t=1,2,…t=1,2,\ldots9 lies outside xtx_t0 for its current segment and, optionally, also fails a global percentile filter.

2. Construction of Confidence Sequences and Segmentation

2.1. Confidence Sequence Formulas

For xtx_t1 and error xtx_t2 per segment, the nonparametric Hoeffding-style confidence sequence for xtx_t3 at time xtx_t4 is

xtx_t5

Alternatively, use empirical standard deviation xtx_t6 and a scaling coefficient xtx_t7:

xtx_t8

with xtx_t9 chosen by threshold-dependent rules. Then set a≤xt≤ba \leq x_t \leq b0, a≤xt≤ba \leq x_t \leq b1.

2.2. Segmentation Algorithms

Two segmentation strategies are provided:

  • APCA (Adaptive Piecewise Constant Approximation):
    • For a window a≤xt≤ba \leq x_t \leq b2, candidate splits at a≤xt≤ba \leq x_t \leq b3 minimize a≤xt≤ba \leq x_t \leq b4.
    • Splits accepted if a≤xt≤ba \leq x_t \leq b5.
    • Segmentation halts at minimal segment length or if improvement is insufficient. For flat regions (coefficient of variation a≤xt≤ba \leq x_t \leq b6), segments default to size a≤xt≤ba \leq x_t \leq b7.
  • K-means Clustering on Sliding-Window Features:
    • Feature extraction: mean, std, median, and skewness per window.
    • Features normalized and clustered into a≤xt≤ba \leq x_t \leq b8 via K-means; failures result in single-segment treatment.

2.3. Composite Anomaly Detection Rule

Anomaly at a≤xt≤ba \leq x_t \leq b9 in segment KK0 is triggered if KK1 or KK2. Optionally, a global percentile filter requires KK3 where KK4 is the KK5-th percentile (e.g., KK6) of training residuals.

3. Statistical Guarantees

SCS inherits its statistical accuracy from nonparametric confidence-sequence theory [Howard et al., 2021]. For independently sampled KK7 in a segment, the constructed confidence sequence intervals KK8 satisfy

KK9

and by a union bound or error allocation,

0=τ0<τ1<τ2<⋯<τK=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty0

Because segmentation depends only on past data, coverage properties are preserved via optional-stopping arguments, even if segmentation is adaptive.

4. Algorithmic Implementation

The SCS workflow, in high-level pseudocode, is as follows:

  1. Offline Segmentation: Segment data via APCA or K-means, as selected.
  2. Initialization: For each segment 0=τ0<τ1<τ2<⋯<τK=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty1, initialize 0=τ0<τ1<τ2<⋯<τK=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty2, 0=τ0<τ1<τ2<⋯<τK=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty3, 0=τ0<τ1<τ2<⋯<τK=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty4 empirical std of a training window.
  3. Online Update: For each 0=τ0<τ1<τ2<⋯<τK=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty5:
    • Assign segment 0=Ï„0<Ï„1<Ï„2<⋯<Ï„K=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty6 by 0=Ï„0<Ï„1<Ï„2<⋯<Ï„K=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty7.
    • Update statistics (0=Ï„0<Ï„1<Ï„2<⋯<Ï„K=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty8, 0=Ï„0<Ï„1<Ï„2<⋯<Ï„K=∞0 = \tau_0 < \tau_1 < \tau_2 < \dots < \tau_K = \infty9, kk0).
    • Compute bound width by Hoeffding or empirical std formula.
    • Flag anomaly if kk1 outside kk2 and, if enabled, kk3 percentile threshold.

Computational Complexity:

  • Segmentation: APCA is worst-case kk4, typically kk5 with pruning; K-means is kk6 per iteration on windowed features.
  • Online update: kk7 per data point.
  • Memory: Requires storing segment boundaries and per-segment aggregates.

5. Parameterization and Operational Considerations

  • Confidence Level (kk8): Common choices are 0.05 or 0.01. Lower kk9 yields wider bounds, fewer false alarms, and lower sensitivity.
  • APCA Improvement Thresholds: Typical values are 0.7 for high variance, 0.5 for moderate variance. Minimum segment length of t∈(Ï„k−1,Ï„k]t\in(\tau_{k-1},\tau_k]0 or t∈(Ï„k−1,Ï„k]t\in(\tau_{k-1},\tau_k]1.
  • Boundedness: Enforce or approximate t∈(Ï„k−1,Ï„k]t\in(\tau_{k-1},\tau_k]2 by truncation or winsorization.
  • Empirical t∈(Ï„k−1,Ï„k]t\in(\tau_{k-1},\tau_k]3 Updates: Can employ Welford’s algorithm for online updates.
  • Global Percentile Filter: Values like t∈(Ï„k−1,Ï„k]t\in(\tau_{k-1},\tau_k]4 provide robustness against local fluctuations; can be disabled to maximize recall at the expense of precision.
  • Assumptions: Within each segment, scores are approximately stationary and independent (or weakly dependent).

6. Empirical Benchmarks and Comparative Results

Evaluation was performed on 151 inline semiconductor sensor traces with approximately 10% defective wafers. The baseline used a fixed 99th-percentile residual threshold. Key SCS results are presented below (Δ relative to baseline):

Method ΔPrecision ΔRecall ΔF1-Score
SCS APCA (t∈(τk−1,τk]t\in(\tau_{k-1},\tau_k]5) –0.3282 +3.9952 +1.9074
SCS KMEANS (t∈(τk−1,τk]t\in(\tau_{k-1},\tau_k]6) –0.3999 +1.6643 +0.9262
SCS APCA (t∈(τk−1,τk]t\in(\tau_{k-1},\tau_k]7) –0.4290 +6.1595 +2.1289
SCS KMEANS (t∈(τk−1,τk]t\in(\tau_{k-1},\tau_k]8) –0.4656 +3.3286 +1.4148

Anomaly counts at t∈(τk−1,τk]t\in(\tau_{k-1},\tau_k]9:

Method TP TN FP FN
Baseline (99th pct) 6 1608 12 137
SCS APCA (kk0) 30 1516 104 113
SCS KMEANS (kk1) 16 1556 64 127

Key findings include a fivefold increase in true positives with SCS APCA (kk2 vs kk3), raising recall from ~4% to ~30%, and an F1-score roughly doubling relative to the baseline for kk4 and more than doubling for kk5. The percentile filter improves precision at the expense of recall, while K-means segmentation produces slightly less aggressive segmentation than APCA and avoids short segments in smooth series (Li et al., 8 Aug 2025).

SCS provides statistically rigorous local adaptation for anomaly detection in nonstationary time series where global or fixed-threshold approaches are rendered inadequate by distributional drift or regime changes. The framework is unsupervised, suitable for settings with scarce labeled anomalies, and is designed for applications such as manufacturing process control, IT infrastructure monitoring, and sensor data streams.

SCS builds conceptually on the theory of confidence sequences for time-uniform, nonparametric inference [Howard et al., 2021], online segmentation methods such as APCA [Keogh et al., 2001], and builds upon work in sequential quantile estimation under concept drift [Wang et al., 2023]. Its guarantee of explicit, interpretable false alarm rates and empirically validated reliability makes it appropriate for high-stakes or automated monitoring scenarios (Li et al., 8 Aug 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Segmented Confidence Sequences (SCS).