Setting a Naive Bayes spam filter's decision rule when false positives cost far more than missed spam

Quick Overview

Asks how to set the decision threshold of a Naive Bayes spam filter when flagging a legitimate email costs far more than missing spam. Tests cost-sensitive Bayes decision rules, probability calibration and choosing a threshold against a false positive target.

Setting a Naive Bayes spam filter's decision rule when false positives cost far more than missed spam

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

In a Naive Bayes spam filter where flagging a legitimate email is far more costly than missing spam, how would you set the decision rule? ```hint Expected cost Write down the expected cost of flagging an email and of letting it through, each as a function of the posterior. ``` ```hint Trusting the posterior Ask whether Naive Bayes probabilities are reliable enough to plug straight into a formula. ``` ### What a Strong Answer Covers - The minimum-expected-cost decision rule and the posterior threshold it implies in terms of the two costs - A worked threshold for a concrete cost ratio, and its log-odds or prior interpretation - Why Naive Bayes posteriors are poorly calibrated, and how to set the threshold anyway (calibration, or choosing it on validation data against a false positive target) - Operational refinements such as a quarantine band and monitoring as spam drifts ### Follow-up Questions - How would you estimate the costs of a false positive and a false negative if the business cannot give you numbers? - Your validation set has only 2,000 legitimate emails. How well can you verify a 0.1% false positive rate, and what would you do about it? - How should the rule change if the share of spam in production doubles? - Would you calibrate this model with Platt scaling or isotonic regression, and why?

Overview: Asks how to set the decision threshold of a Naive Bayes spam filter when flagging a legitimate email costs far more than missing spam. Tests cost-sensitive Bayes decision rules, probability calibration and choosing a threshold against a false positive target.

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

In a Naive Bayes spam filter where flagging a legitimate email is far more costly than missing spam, how would you set the decision rule?

What a Strong Answer Covers Guidance

  • The minimum-expected-cost decision rule and the posterior threshold it implies in terms of the two costs
  • A worked threshold for a concrete cost ratio, and its log-odds or prior interpretation
  • Why Naive Bayes posteriors are poorly calibrated, and how to set the threshold anyway (calibration, or choosing it on validation data against a false positive target)
  • Operational refinements such as a quarantine band and monitoring as spam drifts

Follow-up Questions Guidance

  • How would you estimate the costs of a false positive and a false negative if the business cannot give you numbers?
  • Your validation set has only 2,000 legitimate emails. How well can you verify a 0.1% false positive rate, and what would you do about it?
  • How should the rule change if the share of spam in production doubles?
  • Would you calibrate this model with Platt scaling or isotonic regression, and why?