How does Bernoulli Naive Bayes penalize the absence of a feature?

Quick Overview

Asks how Bernoulli Naive Bayes scores a binary feature that is absent from an example and how that compares with Multinomial Naive Bayes. It tests reading the per-feature likelihood, reasoning with log probabilities and the effect of smoothing on class scores.

How does Bernoulli Naive Bayes penalize the absence of a feature?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How does Bernoulli Naive Bayes penalize the absence of a feature? Assume binary features, such as whether each vocabulary word appears in a document. ```hint Write the likelihood Write $P(x \mid c)$ as a product over every feature in the vocabulary, including the ones equal to 0, and look at the factor an absent feature contributes. ``` ```hint Try numbers Pick a word that appears in most documents of one class and few of another, and compare the log factor its absence adds to each class. ``` ### What a Strong Answer Covers - The per-feature likelihood, including the factor for a feature equal to 0 - When an absence term is large and when it is close to zero - How an absence shifts the decision between two classes - The role of smoothing in the estimated probabilities - How this differs from Multinomial Naive Bayes, and what it means for vocabulary size and document length ### Follow-up Questions - Show that the Bernoulli log-likelihood can be computed from the present features alone plus a per-class constant. - When would you expect Multinomial Naive Bayes to beat Bernoulli Naive Bayes on text, and why? - How does the choice of α change the absence penalty for a word that appears in every training document of a class? - What goes wrong if you plug raw word counts into the Bernoulli likelihood?

Overview: Asks how Bernoulli Naive Bayes scores a binary feature that is absent from an example and how that compares with Multinomial Naive Bayes. It tests reading the per-feature likelihood, reasoning with log probabilities and the effect of smoothing on class scores.

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

How does Bernoulli Naive Bayes penalize the absence of a feature?

Assume binary features, such as whether each vocabulary word appears in a document.

What a Strong Answer Covers Guidance

  • The per-feature likelihood, including the factor for a feature equal to 0
  • When an absence term is large and when it is close to zero
  • How an absence shifts the decision between two classes
  • The role of smoothing in the estimated probabilities
  • How this differs from Multinomial Naive Bayes, and what it means for vocabulary size and document length

Follow-up Questions Guidance

  • Show that the Bernoulli log-likelihood can be computed from the present features alone plus a per-class constant.
  • When would you expect Multinomial Naive Bayes to beat Bernoulli Naive Bayes on text, and why?
  • How does the choice of α change the absence penalty for a word that appears in every training document of a class?
  • What goes wrong if you plug raw word counts into the Bernoulli likelihood?