Skip to content
Preptima
hardConceptMidSeniorStaff

Class weights, oversampling, undersampling, SMOTE. What does each one cost you?

Class weights, oversampling, undersampling and SMOTE are ways to train on imbalanced data, but none creates new signal. They change loss, sample frequency or geometry, so validation, calibration and threshold choice must be handled carefully. Use this class imbalance answer to show the decision, trade-off, and evidence rather than a memorised definition.

5 min readUpdated 2026-08-15

Answer

Short answer

Use class weights to change the loss, oversampling to repeat minority rows, undersampling to discard majority rows and SMOTE to interpolate synthetic minority examples. Keep resampling inside each training fold and recalibrate scores before using them as probabilities.

Was this answer helpful?

Likely follow-ups

  • Derive the prior correction for a model trained on undersampled negatives.
  • Why does class weighting move AUC so little compared with how much it moves the loss?
  • What does SMOTE do to a one-hot encoded column, and why is that a problem?
  • When is collecting or buying more positives cheaper than any of these techniques?

Related questions

Further reading