code wiki / (root) / sketch_naive_bayes_vs_majority_bench.nx

sketch_naive_bayes_vs_majority_bench.nx

buildroot/runtime/sketch_naive_bayes_vs_majority_bench.nx

4407 B127 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind benchtopic sketch
docsdependenciesstructsconstsfunctions

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

syscalls.nx sketch_naive_bayes.nx sketch_comparator.nx sketch_types.nx sketch_naive_bayes_vs_majority

imports: syscalls.nxsketch_naive_bayes.nxsketch_comparator.nxsketch_types.nx

imported by: nobody (leaf or entry point)

structs

none

consts

30const NX_NBB_LCG_A: i64 = 1103515245
31const NX_NBB_LCG_C: i64 = 12345
32const NX_NBB_LCG_MOD: i64 = 0x7FFFFFFF

functions

34func main() -> i64