Why is class imbalance a fundamental problem for standard loss functions?

Quick Overview

Asks why heavy class imbalance causes trouble for losses such as cross-entropy in binary classification. Tests understanding of how the majority class shapes the loss and gradient, how thresholds and metrics mislead, and the trade-offs of weighting, resampling and focal loss.

Why is class imbalance a fundamental problem for standard loss functions?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why is class imbalance a fundamental problem for standard loss functions? Take a binary classifier trained with cross-entropy where positives are about 1% of the data, as in fraud or disease detection. ```hint Split the sum Write the average cross-entropy as one sum over the negative examples plus one over the positives, and compare how many terms each has. ``` ```hint Check the threshold too Ask what probability a well-trained model gives a typical positive when the base rate is 1%, and what the default 0.5 cutoff does with it. ``` ### What a Strong Answer Covers - How averaging over examples lets the majority class dominate the loss and the gradient - The mismatch between equal error costs in the loss and the real costs of each error type - How base-rate-driven probabilities interact with a default threshold, and why accuracy misleads - Remedies at the loss, data, threshold and metric levels, and their side effects ### Follow-up Questions - How does focal loss differ from class weighting, and when would you choose it? - After training with `pos_weight`, are the predicted probabilities still calibrated? How would you correct them? - If you could collect more data, would extra majority-class examples help, hurt or change nothing?

Overview: Asks why heavy class imbalance causes trouble for losses such as cross-entropy in binary classification. Tests understanding of how the majority class shapes the loss and gradient, how thresholds and metrics mislead, and the trade-offs of weighting, resampling and focal loss.

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

Why is class imbalance a fundamental problem for standard loss functions?

Take a binary classifier trained with cross-entropy where positives are about 1% of the data, as in fraud or disease detection.

What a Strong Answer Covers Guidance

  • How averaging over examples lets the majority class dominate the loss and the gradient
  • The mismatch between equal error costs in the loss and the real costs of each error type
  • How base-rate-driven probabilities interact with a default threshold, and why accuracy misleads
  • Remedies at the loss, data, threshold and metric levels, and their side effects

Follow-up Questions Guidance

  • How does focal loss differ from class weighting, and when would you choose it?
  • After training with pos_weight , are the predicted probabilities still calibrated? How would you correct them?
  • If you could collect more data, would extra majority-class examples help, hurt or change nothing?