Score a patient against a statistical portrait of each class. Least surprising class wins.
Bayes' theorem, 1763. The "naive" shortcut, 1960s. Still the baseline spam filter to beat.
768 Pima patients, eight measurements, a diabetes label. All eight in play.
Below: glucose vs BMI. The clouds overlap, but the diabetic cloud leans up and right.
Bayes' rule, drop the constant denominator:
P(y∣x)∝P(y)P(x∣y)Naive assumption — features independent given the class:
P(y∣x)∝P(y)j=1∏DP(xj∣y)Gaussian likelihood per feature, then argmax in log-space:
y^=argcmax[logP(c)+j∑logP(xj∣c)]The fitted bell curves — one per class per feature. This is all the model stores.
Glucose separates cleanly; BMI overlaps. Naive Bayes weights each by its separation.
Each test patient scored against both Gaussians. Rings are 1σ and 2σ; the bar is the verdict.
Colored by prediction, red-ringed when wrong. The mistakes cluster in the overlap.
Low glucose: pinned near 0.95 healthy. Climb into the seam and the bar crosses 0.5 — the boundary is where the two bells pull equally.
GaussianNB is the same model. Both score 0.7727 and agree on all 154 test patients.
Not "close to" the library — bit-for-bit the same fitted parameters.