When would you set uniform class priors instead of learning them from class frequencies?

Quick Overview

Asks when a Naive Bayes or other generative classifier should use uniform class priors instead of priors estimated from training frequencies. Tests understanding of how priors shift decisions, and of class imbalance, deployment shift and calibration.

When would you set uniform class priors instead of learning them from class frequencies?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

In a Naive Bayes classifier, and in generative classifiers generally, the class prior $P(c)$ is usually estimated from how often each class appears in the training data. When would you set uniform class priors instead of learning them from class frequencies? ```hint What the prior adds to a decision Write the two-class decision rule as a log-likelihood ratio plus a log prior ratio, and look at what the second term does to borderline cases. ``` ```hint Where the frequencies came from Ask whether the class mix in the training data matches what the model will see once it is deployed. ``` ### What a Strong Answer Covers - What the prior contributes to the decision rule, and what changes when it is uniform - Situations where training class frequencies are artificial or differ from deployment - Evaluation goals that favor treating every class equally - The costs of uniform priors, including probabilities that no longer reflect real rates - How to set the prior in practice, and alternatives such as using known deployment rates or moving the threshold ### Follow-up Questions - If you know the deployment class rates and they differ from the training mix, what would you do instead of a uniform prior? - In a two-class problem, how is changing the prior related to moving the decision threshold? - Naive Bayes posteriors are often close to 0 or 1 when there are many features. How much does the choice of prior matter then? - How would you check whether the uniform-prior model is the better one for your use case?

Overview: Asks when a Naive Bayes or other generative classifier should use uniform class priors instead of priors estimated from training frequencies. Tests understanding of how priors shift decisions, and of class imbalance, deployment shift and calibration.

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

In a Naive Bayes classifier, and in generative classifiers generally, the class prior P(c)P(c) is usually estimated from how often each class appears in the training data. When would you set uniform class priors instead of learning them from class frequencies?

What a Strong Answer Covers Guidance

  • What the prior contributes to the decision rule, and what changes when it is uniform
  • Situations where training class frequencies are artificial or differ from deployment
  • Evaluation goals that favor treating every class equally
  • The costs of uniform priors, including probabilities that no longer reflect real rates
  • How to set the prior in practice, and alternatives such as using known deployment rates or moving the threshold

Follow-up Questions Guidance

  • If you know the deployment class rates and they differ from the training mix, what would you do instead of a uniform prior?
  • In a two-class problem, how is changing the prior related to moving the decision threshold?
  • Naive Bayes posteriors are often close to 0 or 1 when there are many features. How much does the choice of prior matter then?
  • How would you check whether the uniform-prior model is the better one for your use case?