5.17 Imbalanced data
Your fraud model does better than predicting 'no' every time.
Before:03. Data Handling & AnalysisUnlocks:06. Deep Learning10. Production & MLOps13. Capstones, Portfolio & Interviews
Imbalance is the norm in valuable problems — fraud, defects, churn — and the honest responses are class weights, threshold tuning, and resampling used with care. It sits near the end of the classical run because it modifies everything earlier. The named mistake is SMOTE before the split: synthetic points leak into validation and the score inflates. Threshold tuning is cheaper and safer than resampling more often than the folklore admits.
Work through these
Resampling: SMOTE, undersampling and their risks
Creating synthetic minority examples or discarding majority ones both change the problem you are solving, and both have failure modes. Resampling is popular and it is not the first thing to reach for.
Class weights and cost-sensitive loss
Telling the model that one kind of mistake costs more is frequently cleaner than altering the data. It keeps the data honest and puts the business cost where it belongs.
Threshold tuning over resampling
Adjusting the decision cutoff on a well-fitted model often achieves what resampling was attempted for, with less distortion. This item argues for trying it first.
Metrics that survive imbalance
Overall accuracy is useless when one class is rare, and the measures that survive are the ones focused on the rare class. Choosing them before you start prevents a flattering final report.
Sign in to keep your progress.
Free resources
Links last checked 29 Aug 2026.
Stuck here?
Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.
Checking your session…
Topics shown in module order.