Naive Bayes
Last Updated: July 29, 2026 | By Mihail Sebastian | AI Dictionary
A probabilistic classifier that applies Bayes' theorem under the assumption that features are independent. Simple, fast, and a strong baseline for text tasks.
What is Naive Bayes?
Naive Bayes is a classification algorithm that uses Bayes’ theorem to pick the most probable class for an input, on the assumption that every feature is independent of the others. That assumption is the “naive” part, and real data almost always violates it.
The classifier works well anyway. It trains in one pass over the data, needs few examples, and held its place for decades as the standard first attempt at text classification.
How Naive Bayes Works
For each class \(C\), the algorithm computes how probable the observed features \(x_1, \dots, x_n\) would be if that class were true, weights the result by how common the class is, and picks the winner:
\[ P(C \mid x_1, \dots, x_n) \propto P(C) \prod_{i=1}^{n} P(x_i \mid C) \]The independence assumption is what makes the product on the right legal. Instead of estimating the probability of every combination of features, the model estimates each feature’s probability per class, which it reads straight off counts in the training data.
Training is counting. Prediction is multiplication. Both run on millions of documents without special hardware.
Naive Bayes vs Bayesian Network
The practical difference: Naive Bayes assumes features do not influence one another, while a Bayesian network maps exactly how they do. Both rest on Bayes’ theorem – a Naive Bayes classifier is the simplest possible Bayesian network, one class node with every feature hanging directly off it.
| Criterion | Naive Bayes | Bayesian Network |
|---|---|---|
| Feature dependencies | Assumed away (independent given the class) | Encoded explicitly as edges in a directed graph |
| Structure | Fixed: one class node, features attached to it | Designed by experts or learned from data |
| Typical job | Fast classification, especially of text | Reasoning under uncertainty across related variables |
Example of Naive Bayes
A spam filter trained on 10,000 labeled emails counts how frequently each word appears in spam versus legitimate mail. “Winner” turns up constantly in spam and rarely in normal email; “meeting” shows the reverse pattern.
A new email arrives containing “winner”, “free”, and “prize”. The filter multiplies each word’s spam probability together with the base rate of spam, repeats the calculation for the legitimate class, and compares. Spam wins by orders of magnitude, and the email lands in the junk folder.
The independence assumption is plainly false here: “free” and “prize” travel together in spam. Naive Bayes still ranks the classes correctly, because getting the winner right matters more than getting the exact probabilities right.
Related AI terms: Bayesian Network · Classification · Logistic Regression · Sentiment Analysis
Did you like the Naive Bayes gist?
Learn about 250+ need-to-know artificial intelligence terms in the AI Dictionary.
Mihail Sebastian — Writes about AI governance, regulation, and the technology behind them. Placeholder bio — replace with a real credential line. About