Tabellab
AI & Data Science Intermediate

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.

8 lessons 8 labs 2.2 h Certificate

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

  1. The Accuracy Trap: 3 Faults in 100 Runs, Confusion Counts & the «Always OK» ModelLab15 min Pro
  2. Metrics That Respect the Minority: Balanced Accuracy, the Matthews Coefficient, F1 & FβLab16 min Pro
  3. Random Undersampling & Oversampling: Given Draw Tables, New Class Shares & What Gets LostLab16 min Pro
  4. Synthetic Minority Samples: Neighbour Distances, the k Nearest & New Points by InterpolationLab17 min Pro
  5. Class Weights: n ÷ (k × n_class), a Weighted Log-Loss & a New Best Cut-OffLab16 min Pro
  6. Cost-Based Thresholds: A Cost Matrix, Expected Cost per Run & the Cheapest Cut-OffLab16 min Pro
  7. Probability Correction After Resampling: Training vs Real Prevalence & a Calibration TableLab16 min Pro
  8. Capstone – Comparing Strategies: Balanced Accuracy, MCC, Recall, Expected Cost & a Ranked SummaryLab18 min Pro