How can Naive Bayes handle missing feature values at prediction time?

Quick Overview

Asks how a trained Naive Bayes classifier should score an example with missing feature values. Tests marginalization under conditional independence, when missingness carries signal, and the difference between a missing value and an observed zero.

How can Naive Bayes handle missing feature values at prediction time?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

A trained Naive Bayes classifier receives an example at prediction time where one or more feature values are missing. How can Naive Bayes handle missing feature values at prediction time? ```hint Marginalize Write the class posterior as a product of per-feature likelihoods, then sum over every possible value of the missing feature. Look at what happens to its factor. ``` ```hint Why is it missing? Ask whether the fact that a value is missing could itself tell you something about the class. ``` ### What a Strong Answer Covers - How the model's factorization lets you treat the missing term, and why that is justified - The assumption about why values are missing, and what to do when missingness carries signal - The difference between a missing value and an observed absence in Bernoulli Naive Bayes - How the approach compares with single-value imputation - How to implement it when the library rejects `NaN` ### Follow-up Questions - How would you estimate the class-conditional likelihoods when the training data also has missing values? - For a logistic regression model, what would exact marginalization of a missing feature require? - A field is blank far more often for one class. How would you encode that, and what breaks if the blank rate changes after deployment?

Overview: Asks how a trained Naive Bayes classifier should score an example with missing feature values. Tests marginalization under conditional independence, when missingness carries signal, and the difference between a missing value and an observed zero.

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

A trained Naive Bayes classifier receives an example at prediction time where one or more feature values are missing. How can Naive Bayes handle missing feature values at prediction time?

What a Strong Answer Covers Guidance

  • How the model's factorization lets you treat the missing term, and why that is justified
  • The assumption about why values are missing, and what to do when missingness carries signal
  • The difference between a missing value and an observed absence in Bernoulli Naive Bayes
  • How the approach compares with single-value imputation
  • How to implement it when the library rejects NaN

Follow-up Questions Guidance

  • How would you estimate the class-conditional likelihoods when the training data also has missing values?
  • For a logistic regression model, what would exact marginalization of a missing feature require?
  • A field is blank far more often for one class. How would you encode that, and what breaks if the blank rate changes after deployment?