How can you identify the most indicative features for each class from a trained Naive Bayes model?

Quick Overview

Asks how to read a trained Naive Bayes model to find the features that point most strongly to each class. Tests understanding of per-class likelihoods, the Naive Bayes decision rule, smoothing, and the limits of feature rankings from a model that assumes independent features.

How can you identify the most indicative features for each class from a trained Naive Bayes model?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

You have trained a Naive Bayes classifier, for example on bag-of-words features for spam filtering. How can you identify the most indicative features for each class from a trained Naive Bayes model? ```hint Common is not the same as indicative Think about which words have a high probability under every class at once. ``` ```hint Look at the decision rule Write out the log-odds the model uses to pick a class and see what a single feature adds to it. ``` ### What a Strong Answer Covers - Where the learned per-class parameters live and what they mean - Why ranking by the raw per-class likelihood is misleading - A ranking score tied to the model's decision rule, for both the binary and the multiclass case - How the Gaussian variant differs from the count-based variants - Caveats from rare features, smoothing and correlated features ### Follow-up Questions - How does the ranking change as you raise the smoothing parameter, and how would you pick its value? - In Bernoulli Naive Bayes the absence of a word also counts as evidence. How would you report that? - How would this ranking compare to the coefficients of a logistic regression trained on the same features? - Two near-copies of the same feature both rank near the top. What does that tell you about the model's predicted probabilities?

Overview: Asks how to read a trained Naive Bayes model to find the features that point most strongly to each class. Tests understanding of per-class likelihoods, the Naive Bayes decision rule, smoothing, and the limits of feature rankings from a model that assumes independent features.

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

You have trained a Naive Bayes classifier, for example on bag-of-words features for spam filtering. How can you identify the most indicative features for each class from a trained Naive Bayes model?

What a Strong Answer Covers Guidance

  • Where the learned per-class parameters live and what they mean
  • Why ranking by the raw per-class likelihood is misleading
  • A ranking score tied to the model's decision rule, for both the binary and the multiclass case
  • How the Gaussian variant differs from the count-based variants
  • Caveats from rare features, smoothing and correlated features

Follow-up Questions Guidance

  • How does the ranking change as you raise the smoothing parameter, and how would you pick its value?
  • In Bernoulli Naive Bayes the absence of a word also counts as evidence. How would you report that?
  • How would this ranking compare to the coefficients of a logistic regression trained on the same features?
  • Two near-copies of the same feature both rank near the top. What does that tell you about the model's predicted probabilities?