Imbalanced Data by Hand: The Accuracy Trap, Balanced Metrics, Resampling, Synthetic Minority Samples, Class Weights, Cost-Based Thresholds & Probability Correction
Learn what to do when the class you care about is rare. You will see why accuracy misleads, switch to balanced accuracy and the Matthews coefficient, undersample and oversample with given index tables, create synthetic minority points by interpolation, weight the loss by class, pick a threshold from a cost matrix and correct probabilities after resampling, with every cell checked as you go.
One-time payment · lifetime access · lessons, labs, exam and certificate included · no subscription.
About this course
This course shows what to do when the class you care about is rare, using fictional pump test runs with only a few faults. You count true and false alarms with COUNTIFS and see why a model that never raises an alarm still scores 97 % accuracy. You switch to balanced accuracy, the Matthews coefficient and Fβ, undersample and oversample with given draw tables and build synthetic minority points between neighbours. You weight the log-loss by class, pick the cheapest threshold from a cost matrix, correct probabilities back to the real prevalence and finish by comparing five strategies on one fixed test set.
Lessons
- The Accuracy Trap: 3 Faults in 100 Runs, Confusion Counts & the «Always OK» Model Pro
- Metrics That Respect the Minority: Balanced Accuracy, the Matthews Coefficient, F1 & Fβ Pro
- Random Undersampling & Oversampling: Given Draw Tables, New Class Shares & What Gets Lost Pro
- Synthetic Minority Samples: Neighbour Distances, the k Nearest & New Points by Interpolation Pro
- Class Weights: n ÷ (k × n_class), a Weighted Log-Loss & a New Best Cut-Off Pro
- Cost-Based Thresholds: A Cost Matrix, Expected Cost per Run & the Cheapest Cut-Off Pro
- Probability Correction After Resampling: Training vs Real Prevalence & a Calibration Table Pro
- Capstone – Comparing Strategies: Balanced Accuracy, MCC, Recall, Expected Cost & a Ranked Summary Pro