sketch_naive_bayes_vs_majority_bench.nx
buildroot/runtime/sketch_naive_bayes_vs_majority_bench.nx
about
sketch_naive_bayes_vs_majority_bench.nx -- classification accuracy bench.
CLAIM TO VALIDATE:
Naive Bayes (Maron 1961) outperforms a majority-class baseline
when features actually carry signal about the class. Without
real per-feature likelihood, classification = majority class.
Test: a streaming binary classification task where class 1 has
features {1, 2, 3, 4} with high probability and class 0 has
features {5, 6, 7, 8} with high probability. Some overlap to
make it non-trivial.
WORKLOAD:
Train: 200 samples per class (400 total).
Test: 100 fresh samples per class.
Majority baseline: always predicts the more frequent class
(both 50% here so any constant prediction → 50% accuracy).
NaiveBayes should hit >=80% accuracy by learning the feature
distribution.
MEASUREMENT:
ACCURACY axis: NB correct count vs majority correct count.
dependencies 4 imports · 0 importers
imports: syscalls.nxsketch_naive_bayes.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
| 30 | const NX_NBB_LCG_A: i64 = 1103515245 |
| 31 | const NX_NBB_LCG_C: i64 = 12345 |
| 32 | const NX_NBB_LCG_MOD: i64 = 0x7FFFFFFF |
functions
| 34 | func main() -> i64 |