AIExplainer
Machine Learning Intermediate 2 min read

What is undersampling?

A technique used to reduce the size of a dataset by removing instances from the majority class

Undersampling is a method used to balance datasets where one class has a significantly larger number of instances than the others. By reducing the number of instances in the majority class, the model can better learn from the minority class and improve its performance on that class.

Imagine you're trying to learn about different types of animals, but your textbook has 100 pictures of dogs and only 1 picture of a cat. To make it easier to learn about cats, you might remove some of the dog pictures so that you have a more balanced view of both animals.

In credit card fraud detection, the majority of transactions are legitimate, while only a small percentage are fraudulent. Undersampling the legitimate transactions can help a model better detect fraudulent activity.

Undersampling is used in machine learning to prevent models from being biased towards the majority class. It is often used in conjunction with oversampling, where the minority class is increased in size, to create a more balanced dataset.

One common misconception is that undersampling will always improve model performance. However, if the majority class is reduced too much, the model may lose important information and perform worse.

Undersampling has been used in machine learning for decades, but its importance has grown in recent years with the increasing availability of large, imbalanced datasets.

downsampling majority class undersampling

Three products for different needs — explore what’s relevant to you.