Skip to main content

u_analytics/detection/
mod.rs

1//! Change-point and shift detection.
2//!
3//! Algorithms for detecting process mean shifts and trend changes, covering
4//! both **online** (sequential surveillance) and **offline** (retrospective)
5//! approaches.
6//!
7//! # Online Detection (Sequential Surveillance)
8//!
9//! - [`Cusum`] — Cumulative Sum chart (Page, 1954) for detecting small persistent shifts
10//! - [`Ewma`] — Exponentially Weighted Moving Average chart (Roberts, 1959)
11//!
12//! # Offline Detection (Retrospective Changepoint Analysis)
13//!
14//! - [`Pelt`] — Pruned Exact Linear Time algorithm (Killick et al., 2012) for
15//!   detecting multiple changepoints with O(n) expected complexity
16//! - [`SpectralResidual`] — Saliency-based one-shot anomaly scoring
17//!   (Ren et al., 2019): spikes, steps and dropouts without a trained model
18//!
19//! # References
20//!
21//! - Page, E.S. (1954). "Continuous Inspection Schemes",
22//!   *Biometrika* 41(1/2), pp. 100-115.
23//! - Roberts, S.W. (1959). "Control Chart Tests Based on Geometric Moving Averages",
24//!   *Technometrics* 1(3), pp. 239-250.
25//! - Killick, R., Fearnhead, P., & Eckley, I.A. (2012). "Optimal Detection of
26//!   Changepoints with a Linear Computational Cost", *JASA* 107(500), pp. 1590-1598.
27//! - Ren, H. et al. (2019). "Time-Series Anomaly Detection Service at Microsoft",
28//!   *KDD 2019*, pp. 3009-3017.
29
30mod cusum;
31mod ewma;
32mod pelt;
33mod spectral_residual;
34
35pub use cusum::{Cusum, CusumResult};
36pub use ewma::{Ewma, EwmaResult};
37pub use pelt::{CostFunction, MultiPeltResult, Pelt, PeltResult, Penalty};
38#[cfg(any(feature = "wasm", feature = "ffi"))]
39pub(crate) use spectral_residual::CountOption as SrCountOption;
40pub use spectral_residual::{
41    SpectralResidual, SpectralResidualError, SrPoint, MIN_OBSERVATIONS as SR_MIN_OBSERVATIONS,
42};