code wiki / (root) / sketch_cusum_vs_threshold_bench.nx

sketch_cusum_vs_threshold_bench.nx

buildroot/runtime/sketch_cusum_vs_threshold_bench.nx

3928 B99 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind benchtopic sketch
docsdependenciesstructsconstsfunctions

about

sketch_cusum_vs_threshold_bench.nx -- change-point detection bench. CLAIM TO VALIDATE: CUSUM (Page 1954) detects a SHIFT in stream mean faster and with fewer false alarms than a single-threshold rule. Threshold-only alerts when ANY sample crosses the threshold -- prone to false positives from natural noise. CUSUM accumulates evidence over multiple samples, so it triggers only on persistent drift. WORKLOAD: - Phase 1 (steps 1..100): samples ~ N(100, 5) -- normal regime - Phase 2 (steps 101..200): samples ~ N(120, 5) -- shifted mean Threshold = 115 (between the two means). MEASUREMENT: CUSUM: count detections in Phase 1 (false alarms) vs Phase 2. Threshold: same. Score = (correct detections in Phase 2) - (false alarms in Phase 1). Higher wins.

dependencies 4 imports · 0 importers

syscalls.nx sketch_cusum.nx sketch_comparator.nx sketch_types.nx sketch_cusum_vs_threshold_benc

imports: syscalls.nxsketch_cusum.nxsketch_comparator.nxsketch_types.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_cusum_alloc nx_cusum_n_alarms nx_cusum_add nx_cmp_memory

structs

none

consts

27const NX_CUB_LCG_A: i64 = 1103515245
28const NX_CUB_LCG_C: i64 = 12345
29const NX_CUB_LCG_MOD: i64 = 0x7FFFFFFF

functions

31func main() -> i64