What do the prior, likelihood and posterior mean in a Naive Bayes classifier?

Quick Overview

Explains the three terms of Bayes' theorem as they appear in a Naive Bayes classifier: the prior, the likelihood and the posterior. Tests whether you can say where each term comes from in training, how they combine into a prediction, and what role the evidence term plays.

What do the prior, likelihood and posterior mean in a Naive Bayes classifier?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

What do the prior, likelihood and posterior mean in a Naive Bayes classifier? ```hint Write the formula first Write Bayes' theorem for $P(y \mid x)$, name each term, and then ask which terms the classifier actually needs to pick a class. ``` ### What a Strong Answer Covers - What the prior, likelihood and posterior each mean, with notation, and how Bayes' theorem combines them. - Where each term comes from in training, including how the naive independence assumption factorizes the likelihood and how the variant (Gaussian, Multinomial, Bernoulli) sets its form. - How a prediction is made, and the role of the evidence term. - Why the likelihoods across classes need not sum to 1 while the posteriors do. ### Follow-up Questions - What happens when a word never appears with a class in the training data, and how do you fix it? - Why are Naive Bayes posterior probabilities often poorly calibrated even when its accuracy is good? - Why do implementations add log-probabilities instead of multiplying probabilities? - When would you set the class prior by hand instead of estimating it from the training data?

Overview: Explains the three terms of Bayes' theorem as they appear in a Naive Bayes classifier: the prior, the likelihood and the posterior. Tests whether you can say where each term comes from in training, how they combine into a prediction, and what role the evidence term plays.

General logo
General
Nov 25, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

What do the prior, likelihood and posterior mean in a Naive Bayes classifier?

What a Strong Answer Covers Guidance

  • What the prior, likelihood and posterior each mean, with notation, and how Bayes' theorem combines them.
  • Where each term comes from in training, including how the naive independence assumption factorizes the likelihood and how the variant (Gaussian, Multinomial, Bernoulli) sets its form.
  • How a prediction is made, and the role of the evidence term.
  • Why the likelihoods across classes need not sum to 1 while the posteriors do.

Follow-up Questions Guidance

  • What happens when a word never appears with a class in the training data, and how do you fix it?
  • Why are Naive Bayes posterior probabilities often poorly calibrated even when its accuracy is good?
  • Why do implementations add log-probabilities instead of multiplying probabilities?
  • When would you set the class prior by hand instead of estimating it from the training data?