Naive Bayes
A fast probabilistic classifier that applies Bayes' theorem while naively assuming every feature is independent. Famous as an early spam filter.
Also Bayes' theorem · Bayesian classifier
Words like 'winner' and 'free' appear a lot in spam. Count how spammy each word in an email is, multiply the evidence together, and decide.
Where it fits
+All relationships as a list
How it works
Bayes’ theorem turns “how likely is this evidence if the email is spam?” into “how likely is the email spam given this evidence?”. Naive Bayes applies it with a bold simplification: it treats every word (feature) as independent evidence, given the class.
Training is just counting:
- How often each word appears in spam and in normal email.
- How common spam is overall.
To classify a new email, multiply the class’s overall probability by the probability of each word under that class, and compare spam against not-spam. (In practice you add logarithms instead of multiplying, and add a small constant to counts so unseen words do not zero everything out.)
The independence assumption is clearly false, since “free” and “money” tend to appear together, yet the ranking of classes is often right anyway. That made naive Bayes the engine of early 2000s spam filters, and it is still a quick, sturdy baseline before trying logistic regression or neural networks.
The math
Everyday use cases
- Case 01
Spam filtering
Classic email filters learned which words signal spam from examples users marked.
- Case 02
Quick text categorization
Sorting news articles or support tickets by topic as a fast baseline.
Famous examples
Strengths, weaknesses and when to use it
Strengths
- Extremely fast to train and predict; needs little data.
- Easy to update with new examples.
Weaknesses
- The independence assumption is wrong, so probabilities are poorly calibrated.
- Usually beaten by modern models when data is plentiful.
When to use itAs a fast baseline for text classification, or when data and compute are very limited.
Compare with
Check yourself
- Q01
What is "naive" about naive Bayes?
Show answer
A: It assumes features are independent of each other given the class