5.9 Naive Bayes
You can build a fast text classifier in ten lines.
Before:03. Data Handling & AnalysisUnlocks:06. Deep Learning10. Production & MLOps13. Capstones, Portfolio & Interviews
Naive Bayes assumes features are independent given the class — false nearly always, and the classifier works remarkably well anyway, especially on text, where it delivers a strong baseline in minutes. Smoothing handles the zero-probability edge. It sits here as the probabilistic quick win. The caution that matters: its probability outputs are poorly calibrated precisely because the independence assumption is false, so trust the rankings and doubt the confidence.
Work through these
The conditional independence assumption
The method assumes every feature is independent given the class, which is nearly always false. Understanding what the assumption buys is more useful than defending it.
Gaussian, multinomial, Bernoulli variants
Three variants for three kinds of feature: continuous, counts, and presence or absence. Choosing the right one matters more than any tuning.
Smoothing and zero probabilities
A category never seen with a class would otherwise force a probability of zero and veto everything else. A small correction avoids that, and it is essential rather than cosmetic.
Why it works despite being wrong
The independence assumption is wrong and the classifier still ranks well, because ranking survives errors that probability estimation does not. That explanation is the interesting part of the topic.
Sign in to keep your progress.
Free resources
Links last checked 29 Aug 2026.
Stuck here?
Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.
Checking your session…
Topics shown in module order.