How do you correct predicted probabilities back to the true class prior after undersampling?

Quick Overview

Asks how to map probabilities from a classifier trained on undersampled data back to the real class prior. Tests the odds-based correction, its logit form as an intercept shift, the general prior-shift reweighting for multiclass, and the cases where the correction does not hold.

How do you correct predicted probabilities back to the true class prior after undersampling?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How do you correct predicted probabilities back to the true class prior after undersampling? Suppose you trained a binary classifier on data where you kept only a random fraction of the negative examples. The model's scores now reflect the training mix, which has a much higher positive rate than the data it will score in production. ```hint Look at the odds Write the model's output as odds and ask how keeping a fraction of the negatives changes the ratio of positives to negatives the model saw. ``` ### What a Strong Answer Covers - The correction formula for random undersampling of negatives and where it comes from - The equivalent logit form and what it means for a logistic regression intercept - The general prior-shift reweighting that also handles multiclass problems - The assumptions behind the correction and the sampling methods where it does not hold - What the correction changes (probabilities, threshold decisions) and what it leaves alone (ranking, AUC) ### Follow-up Questions - How would you check that the corrected probabilities are calibrated? - If you had used SMOTE instead of random undersampling, how would you get calibrated probabilities? - You trained with class weights instead of undersampling. Does the same correction apply? - How do you apply the correction when several classes in a multiclass problem were undersampled at different rates?

Overview: Asks how to map probabilities from a classifier trained on undersampled data back to the real class prior. Tests the odds-based correction, its logit form as an intercept shift, the general prior-shift reweighting for multiclass, and the cases where the correction does not hold.

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

How do you correct predicted probabilities back to the true class prior after undersampling?

Suppose you trained a binary classifier on data where you kept only a random fraction of the negative examples. The model's scores now reflect the training mix, which has a much higher positive rate than the data it will score in production.

What a Strong Answer Covers Guidance

  • The correction formula for random undersampling of negatives and where it comes from
  • The equivalent logit form and what it means for a logistic regression intercept
  • The general prior-shift reweighting that also handles multiclass problems
  • The assumptions behind the correction and the sampling methods where it does not hold
  • What the correction changes (probabilities, threshold decisions) and what it leaves alone (ranking, AUC)

Follow-up Questions Guidance

  • How would you check that the corrected probabilities are calibrated?
  • If you had used SMOTE instead of random undersampling, how would you get calibrated probabilities?
  • You trained with class weights instead of undersampling. Does the same correction apply?
  • How do you apply the correction when several classes in a multiclass problem were undersampled at different rates?