Course contentsShow
← Machine Learning and Deep Learning
Lesson 542 of 3,53813. Imbalanced and Multi-Label ProblemsFree lesson

Resampling: Undersampling the Majority Class

Compare random undersampling, Tomek links, and edited nearest neighbors for reducing majority class without losing information.

Resampling: Undersampling the Majority Class

What you'll learn: You'll discover three techniques for reducing the majority class—random undersampling, Tomek links, and edited nearest neighbors—and understand their trade-offs between speed and information preservation.

The Core Challenge

Where oversampling creates more minority examples, undersampling removes majority class examples to balance your dataset. Think of it like thinning a crowded forest—you're removing trees (majority samples) to give rare plants (minority class) better visibility. The key question: which trees do you cut without destroying the ecosystem?

Three Undersampling Strategies

Random Undersampling

Randomly delete majority class samples until classes are balanced. Fast and simple, but you might discard valuable information. Like throwing away random pages from a book—you'll lose important context.

Tomek Links

Identifies pairs of opposite-class samples that are each other's nearest neighbors, then removes the majority class sample from each pair. This cleans up noisy boundary regions where classes overlap. More surgical than random removal—you're removing confusing examples that blur the decision boundary.

Edited Nearest Neighbors (ENN)

Removes majority samples that are misclassified by their k-nearest neighbors. If a majority sample is surrounded mostly by minority samples, it's probably noise or an outlier—so remove it. This creates cleaner, more defined class regions.

Trade-offs

Random undersampling is fastest but risks losing informative samples. Tomek links preserve overall distribution while cleaning boundaries. ENN is most conservative, removing only suspicious samples but may not balance classes fully.

Unlike oversampling (which risks overfitting synthetic data), undersampling risks underfitting by discarding real information.

Key Takeaway: Undersampling reduces majority class size through random deletion, boundary cleaning (Tomek links), or neighbor-based filtering (ENN)—each trading speed for information preservation differently.