Skip to content
SamplePreview build: teacher profiles, ratings, reviews and lesson counts are sample data.
All tutors

Imbalanced Classes, Handled Carefully

Model rare events like fraud or failures without tricks that quietly backfire

By Lukas Brenner Intermediate Machine learning 4.5(4) 86 lessons taught Sample

Your first 3 replies from the tutor are free. Then you can continue the lesson for $7 from your credit.

A taste of a lesson

One question and the answer, as this tutor gives it.

Imbalanced Classes, Handled Carefully AI tutor following Lukas Brenner's plan
Student:

I applied SMOTE to my whole dataset, then did cross validation. Recall jumped from 0.4 to 0.9. Great?

Tutor:

Unfortunately that jump is probably not real. SMOTE created synthetic positives by interpolating between real ones before you split, so validation folds contain points that are near copies of training points. The model is partly recognising its own neighbours. Redo it with SMOTE inside a pipeline so it runs only on each training fold, and keep validation at the natural ratio. Also try plain threshold tuning as a comparison. What recall do you get at the precision your team can live with?

Written by the teacher as an example. In your lesson the tutor answers your own questions, and like any AI it can be wrong.

What you will be able to do

  • Set up evaluation that reflects a rare positive class
  • Use threshold tuning and class weights before reaching for resampling
  • Apply resampling only inside training folds
  • Recalibrate probabilities after weighting or resampling
  • Choose an approach with a written decision checklist

Lesson plan

6 lessons. Pick one to start there.

  1. 1 When imbalance is a real problem Separate the real issues from the label 'imbalanced'. Start
  2. 2 Evaluation for rare events Measure performance honestly on the natural class ratio. Start
  3. 3 Thresholds and class weights Use the two simplest, most reliable adjustments first. Start
  4. 4 Resampling methods Understand under, over and synthetic sampling and their risks. Start
  5. 5 Probabilities after rebalancing Recalibrate scores so they reflect real frequencies. Start
  6. 6 Very rare classes Handle extreme rarity with alternative framings. Start

Try asking

Tap a question to start a lesson with it.

About this tutor

An intermediate tutor for learners facing rare positive classes: fraud, defects, churn in a stable business, rare diseases in education datasets. You will set up evaluation that reflects rarity, then compare honest options: threshold tuning, class weights, undersampling, oversampling and synthetic sampling, and gathering more positive examples. Lessons explain why resampling must stay inside training folds, how it distorts predicted probabilities, and how to recalibrate. You finish with a decision checklist for your own imbalanced problem rather than a single trick.

Reviews

4.5

4 ratingsSample

  • Oskar L.Sample

    Clear checklists. Would have liked more on cost weighted metrics, but overall solid.

  • Ngozi E.Sample

    Helped me explain to my lead why our balanced test set was giving fantasy numbers.

  • Gabriel S.Sample

    Exactly my mistake: SMOTE before splitting. After fixing it, threshold tuning alone did about as well, which was humbling and useful.

  • Fatima Z.Sample

    Very balanced view of resampling. The calibration lesson was new to me and immediately relevant.

About the teacher

Lukas Brenner

Model evaluation you can trust: splits, metrics, leakage and tuning

9 tutors 4.5(22) 439 lessons taught Sample

Most of the machine learning failures I have seen were not about the algorithm. They came from a test set that was used too often, a feature that leaked the answer, or a metric that hid the real cost of mistakes. I teach the unglamorous discipline that makes model results believable: how to split data, how to validate, which metric...

See Lukas's profile and tutors