AI & LLMs

Naive Bayes

A fast probabilistic classifier that assumes features are independent — surprisingly effective for text.

Naive Bayes is a probabilistic classifier that applies Bayes’ theorem with a “naive” assumption: that all features are conditionally independent given the class. Despite that usually-false assumption, it is fast, needs little data, and works remarkably well — famously for spam filtering and text classification.

Worked example: a spam filter estimates the probability of spam given the words by multiplying each word’s probability under spam versus not-spam; words like “free” and “winner” push the estimate toward spam. Gotcha: the independence assumption means it mishandles correlated features (it double-counts evidence), and a word never seen in training gives zero probability that wipes out the whole product — which is why Laplace smoothing (add a small count to every word) is essential.