Show that a naive Bayes classifier with two classes and binary features is a linear classifier in , and give its weights. For , , , , , find the log-odds for and . What goes wrong if feature 2 is copied twice?
Supervised learning, Naive Bayes
Level L3 Intermediate. Length Long. Nature Th+Mat Both.
What's being asked
Whether you can write the log-odds of naive Bayes as a sum of per-feature terms, and see how correlated features distort it.
Key idea
with , where .
Steps
- Log-odds , using the naive independence assumption.
- For a binary feature, . Collect terms in : .
- So log-odds with and . This is linear, like logistic regression.
- Numbers: . .
- .
- : (so ). : . Check directly: . ✓.
- If feature 2 is copied, the model counts the same evidence twice: its weight effectively doubles, and for the log-odds becomes instead of . The ranking may be unchanged here, but the probability becomes over-confident, and a duplicated weak feature can outvote genuine evidence from other features.
Common mistakes
- Thinking naive Bayes cannot have a linear boundary because of the product. In log space the product becomes a sum.
- Forgetting the term, which contributes to the bias .
- Believing the probabilities are well calibrated. Independence errors usually push them towards 0 or 1 even when the ranking is fine.
How long your answer should be
One page; 7 minutes.
Last checked on 4 December 2026.
Read this
Previous in Supervised learning: For GDA with binary , and , how do you derive the maximum likelihood estimates of , , and from labelled points?
Next in Supervised learning: In least-squares linear regression, why is the fitted vector the orthogonal projection of onto the column space of , and what does this say about the residuals?