ML Foundations
Back to Supervised Learning

Class Imbalance — SMOTE, Class Weights, Threshold Adjustment

When 1% of your data is the class you care about. Three strategies for handling it. FIND_VIDEO: search 'class imbalance SMOTE class weight' — recommended channel: StatQuest. Aim for 10 min or under.

18 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.
Loading progress...

Key moments

  1. SMOTE Concept — SMOTE generates synthetic data via interpolation to maintain diversity and mitigate overfitting from simple duplication.
  2. Interpolation Mechanics — Synthetic samples are created along the line segment connecting existing minority examples to visualize a balanced dataset.
  3. SMOTE Formula — The SMOTE algorithm uses KNN to select neighbors and applies a linear interpolation formula to calculate the new synthetic point.
  4. Standard SMOTE Drawbacks — Standard SMOTE can generate noisy synthetic examples or introduce class overlap when minority instances are near majority class boundaries.
  5. Borderline SMOTE Theory — Borderline SMOTE addresses noise by identifying minority points near the decision boundary and restricting interpolation to only minority-class neighbors.
  6. Python Setup — Practical preparation involves loading imbalanced data, dropping irrelevant features, and preprocessing categorical variables using label encoding.
PDF notes

Frequently asked questions

Why does SMOTE use interpolation instead of simple duplication?

Interpolation creates diverse, synthetic data points that fill the feature space, which reduces the risk of overfitting compared to duplicating identical samples.

What is the role of the random number R in the interpolation formula?

R is a random number between 0 and 1 that determines how far the new synthetic sample S1 is placed along the line segment between X and X1.

How does Borderline SMOTE identify "borderline examples"?

It uses KNN to check if a minority point has a significant number of majority class neighbors, indicating it is close to the decision boundary.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.