sketch_mg_ss_bracket_bench.nx
buildroot/runtime/sketch_mg_ss_bracket_bench.nx
about
sketch_mg_ss_bracket_bench.nx -- bracketing capability paired bench.
CLAIM TO VALIDATE:
Misra-Gries (1982) UNDERESTIMATES the count: mg_est <= truth.
SpaceSaving (Metwally et al. 2005) OVERESTIMATES: ss_est >= truth.
Together they BRACKET the true count.
Apache DataSketches ships only the SpaceSaving-direction
"frequent items" sketch. Substrate ships BOTH; bracket gives
callers a guaranteed-correct interval (mg_est, ss_est) within
which the true count lies. Capability EXCEED.
WORKLOAD:
k=10 for both. Heavy items 1..5 with counts 2000/1000/500/200/100.
Noise: 500 singletons. Total N=4300. N/(k+1)=391 -- items 1..3
are guaranteed heavy (truth >= 391); items 4 and 5 are borderline.
MEASUREMENT:
For items 1..3 (guaranteed heavy):
- mg_est <= truth (sealed underestimate property)
- ss_est >= truth (sealed overestimate property)
- bracket_width = ss_est - mg_est > 0 (non-degenerate interval)
- truth INSIDE [mg_est, ss_est]
Aggregate: signed bias over 3 items
mg_signed <= 0 across all items (underestimate is sealed)
ss_signed >= 0 across all items (overestimate is sealed)
dependencies 5 imports · 0 importers
imports: syscalls.nxsketch_misra_gries.nxsketch_space_saving.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
structs
| none |
consts
| none |
functions
| 35 | func main() -> i64 |