How is naive Bayes drawn as a graphical model, and what is its independence assumption? A spam filter has . The word "offer" appears in 60% of spam and 10% of ham (non-spam) emails; the word "meeting" appears in 30% of spam and 50% of ham. Using only these two words, what is for an email that contains both?
Probabilistic models, Naive Bayes
Level L2 Elementary. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you can turn the graph's assumption into a factorised likelihood and run Bayes' rule with numbers.
Key idea
In naive Bayes the class is the only parent of every feature, so features are conditionally independent given the class: , and therefore .
Steps
- Draw with an arrow to each and no edges between features. State .
- Write the posterior: The denominator just makes the two class probabilities add up to 1.
- Spam score: . Ham score: .
- Normalise: .
- Comment: the independence assumption is usually false (words co-occur), so the probabilities are poorly calibrated, but the argmax is often still right. Mention Laplace smoothing for words never seen with a class, and summing logs to avoid underflow.
Common mistakes
- Saying the features are assumed independent. They are assumed independent given the class, not marginally.
- Forgetting the prior, or forgetting to normalise and reporting as the probability.
- Using for . It is a separate number, here.
How long your answer should be
The graph, the formula and a four-line computation; 2–3 minutes.
Last checked on 4 December 2026.
Read this
Previous in Probabilistic models: Two neighbouring pixels in a photo are usually the same colour, but neither one causes the other. How can a plain undirected link with agreement scores describe this, and how are the scores turned into probabilities?
Next in Probabilistic models: An HMM has hidden states Rainy (R) and Sunny (S), initial probabilities , transitions , , , , and emissions , , , . Using the Viterbi algorithm, what is the most likely hidden sequence for the observations (walk, shop)?