Walk through how a Naive Bayes spam filter classifies a new email.

Quick Overview

Walks through how a trained Naive Bayes spam filter turns a new email into features, scores the spam and ham classes, and makes a decision. Tests understanding of class priors, smoothed word likelihoods, log-space scoring, unseen words and threshold choice.

Walk through how a Naive Bayes spam filter classifies a new email.

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

Walk through how a Naive Bayes spam filter classifies a new email. Assume the filter has already been trained on a labeled set of spam and ham (legitimate) emails. Describe what happens from the moment a new email arrives to the final spam or ham decision. ```hint Two pitfalls to plan for Think about what happens numerically when you multiply hundreds of small word probabilities, and what happens when the email contains a word that never appeared in spam during training. ``` ### What a Strong Answer Covers - How the email is turned into features, and the difference between count and presence features - Which parameters were learned in training, and how smoothing keeps any probability from being zero - The scoring rule for each class and the independence assumption behind it - Why the computation runs in log space, and how unseen words are handled - How the final decision is made, including how the threshold reflects the cost of losing a real email ### Follow-up Questions - How does a Bernoulli Naive Bayes filter score an email differently from a multinomial one? - Naive Bayes posteriors are often very close to 0 or 1. Why, and what does that mean for choosing a threshold? - How would spammers try to get past this filter, and how would you adapt it? - How would you update the model as newly labeled mail arrives?

Overview: Walks through how a trained Naive Bayes spam filter turns a new email into features, scores the spam and ham classes, and makes a decision. Tests understanding of class priors, smoothed word likelihoods, log-space scoring, unseen words and threshold choice.

PracHub logo
General
Nov 24, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

Walk through how a Naive Bayes spam filter classifies a new email.

Assume the filter has already been trained on a labeled set of spam and ham (legitimate) emails. Describe what happens from the moment a new email arrives to the final spam or ham decision.

What a Strong Answer Covers Guidance

  • How the email is turned into features, and the difference between count and presence features
  • Which parameters were learned in training, and how smoothing keeps any probability from being zero
  • The scoring rule for each class and the independence assumption behind it
  • Why the computation runs in log space, and how unseen words are handled
  • How the final decision is made, including how the threshold reflects the cost of losing a real email

Follow-up Questions Guidance

  • How does a Bernoulli Naive Bayes filter score an email differently from a multinomial one?
  • Naive Bayes posteriors are often very close to 0 or 1. Why, and what does that mean for choosing a threshold?
  • How would spammers try to get past this filter, and how would you adapt it?
  • How would you update the model as newly labeled mail arrives?