How does class imbalance affect a logistic regression model, and what conceptual approaches would you use to address it?

Quick Overview

Asks how class imbalance changes a logistic regression model's probabilities, threshold behavior and evaluation, and which approaches correct for it. Tests understanding of log-loss, metric choice, cost-based thresholds, class weights, resampling and recalibration.

How does class imbalance affect a logistic regression model, and what conceptual approaches would you use to address it?

Role: Data Scientist

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How does class imbalance affect a logistic regression model, and what conceptual approaches would you use to address it? Think of a binary problem such as fraud or churn prediction, where the positive class is a small fraction of the rows. ```hint Separate the model from the decision Ask whether the predicted probabilities are actually wrong, or whether the trouble is in what you do with them afterward. ``` ```hint Check what each fix does to the probabilities Reweighting and resampling change the class ratio the model sees during training. Work out what that does to the intercept. ``` ### What a Strong Answer Covers - How imbalance shows up in the fitted model: the intercept, low predicted probabilities and the effect of a 0.5 threshold - Why accuracy misleads, and which metrics to use instead - Choosing the decision threshold from the costs of each error type - Class weighting and resampling, what they do to calibration, and how to correct for it - When imbalance is a real estimation problem (too few minority examples) and when it needs no fix at all ### Follow-up Questions - If a missed positive costs 20 times as much as a false alarm, what threshold would you use on a calibrated model? - How do you recover calibrated probabilities after training with `class_weight='balanced'`? - When would you undersample the majority class instead of using class weights? - With only 50 positive examples, what changes in how you fit and evaluate the model?

Overview: Asks how class imbalance changes a logistic regression model's probabilities, threshold behavior and evaluation, and which approaches correct for it. Tests understanding of log-loss, metric choice, cost-based thresholds, class weights, resampling and recalibration.

Nov 25, 2026
mediumData ScientistOtherMachine Learning
0
0

How does class imbalance affect a logistic regression model, and what conceptual approaches would you use to address it?

Think of a binary problem such as fraud or churn prediction, where the positive class is a small fraction of the rows.

What a Strong Answer Covers Guidance

  • How imbalance shows up in the fitted model: the intercept, low predicted probabilities and the effect of a 0.5 threshold
  • Why accuracy misleads, and which metrics to use instead
  • Choosing the decision threshold from the costs of each error type
  • Class weighting and resampling, what they do to calibration, and how to correct for it
  • When imbalance is a real estimation problem (too few minority examples) and when it needs no fix at all

Follow-up Questions Guidance

  • If a missed positive costs 20 times as much as a false alarm, what threshold would you use on a calibrated model?
  • How do you recover calibrated probabilities after training with class_weight='balanced' ?
  • When would you undersample the majority class instead of using class weights?
  • With only 50 positive examples, what changes in how you fit and evaluate the model?