Naive Bayes Tutorial: Probability Over Features

TL;DRNaive Bayes classifies using probability and a "naive" independence assumption — fast and surprisingly good for text.

It applies Bayes' theorem assuming features are independent given the class (the "naive" part — usually false, yet it works). Compute the probability of each class given the features and pick the highest. It's extremely fast, needs little data, and is a classic strong baseline for spam filtering and text classification despite its simplistic assumption.

Key points

Common mistakes

Try it: Explain why "naive" independence still works for spam filtering.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>P(spam | words) ∝ P(words | spam) · P(spam)
assume words independent (naive) → fast, works for text</pre></body></html>
Open the interactive lesson →
Svm · Support Vector Machines Knn · K-Nearest Neighbors