Why does the intercept shift when you resample a dataset for a logistic regression, and what is rare-event bias?

Quick Overview

Asks why the intercept of a logistic regression shifts after you oversample or undersample a class, and what rare-event bias means. Tests the log-odds algebra behind outcome-based sampling, how to restore calibrated probabilities, and how maximum likelihood behaves with few events.

Why does the intercept shift when you resample a dataset for a logistic regression, and what is rare-event bias?

Role: Data Scientist

Category: Machine Learning

Difficulty: hard

Interview Round: Other

Why does the intercept shift when you resample a dataset for a logistic regression, and what is rare-event bias? For context, assume you undersample the majority class or oversample the minority class before fitting, which is a common way to handle imbalanced labels. ```hint Write the sample odds Give events and non-events separate probabilities of being kept, then use Bayes' rule to write $P(Y=1 \mid x)$ for a row that made it into the sample. Look at what happens to the log-odds. ``` ```hint Rate or count For rare-event bias, ask whether the trouble comes from a low event rate or from a small number of events. ``` ### What a Strong Answer Covers - Why the intercept tracks the base rate of the sample and why the slopes survive sampling on the outcome, ideally with the log-odds offset written out. - How to undo the shift (prior correction or weighting), and what the shift does to calibration and to ranking metrics. - The cases where the slope argument breaks, such as sampling that also depends on the features or synthetic oversampling. - What rare-event bias is, which way it pushes predicted probabilities, what drives it, and how to reduce it. ### Follow-up Questions - After undersampling, AUC on a holdout set barely moves but the predicted probabilities are far too high. Why, and how do you fix it? - When would you prefer case weighting to prior correction? - Does SMOTE preserve the slope coefficients the way random undersampling does? - You have 10 million rows and a 0.1% event rate. Is rare-event bias a concern?

Overview: Asks why the intercept of a logistic regression shifts after you oversample or undersample a class, and what rare-event bias means. Tests the log-odds algebra behind outcome-based sampling, how to restore calibrated probabilities, and how maximum likelihood behaves with few events.

Nov 25, 2026
hardData ScientistOtherMachine Learning
0
0

Why does the intercept shift when you resample a dataset for a logistic regression, and what is rare-event bias?

For context, assume you undersample the majority class or oversample the minority class before fitting, which is a common way to handle imbalanced labels.

What a Strong Answer Covers Guidance

  • Why the intercept tracks the base rate of the sample and why the slopes survive sampling on the outcome, ideally with the log-odds offset written out.
  • How to undo the shift (prior correction or weighting), and what the shift does to calibration and to ranking metrics.
  • The cases where the slope argument breaks, such as sampling that also depends on the features or synthetic oversampling.
  • What rare-event bias is, which way it pushes predicted probabilities, what drives it, and how to reduce it.

Follow-up Questions Guidance

  • After undersampling, AUC on a holdout set barely moves but the predicted probabilities are far too high. Why, and how do you fix it?
  • When would you prefer case weighting to prior correction?
  • Does SMOTE preserve the slope coefficients the way random undersampling does?
  • You have 10 million rows and a 0.1% event rate. Is rare-event bias a concern?