What is undersampling

Machine Learning is an exciting field that is continuing to progress rapidly. It has become an essential component for many areas of the industry, including finance, retail, and healthcare. Among the many aspects of machine learning, undersampling is an important technique that helps to address class imbalance in the data. In this article, we discuss the concept of undersampling in machine learning, its benefits, and how it works.

What is Undersampling in Machine Learning?

Undersampling is a technique in machine learning that aims to balance the representation of classes within a dataset. In most datasets, there is an unequal distribution of classes, where one class is dominating while another is significantly under-represented. In such scenarios, the predictive model tends to overweight the dominant class, ignoring the minority class. This results in lower accuracy, reduced precision, and lower recall.

Undersampling is a technique that helps to balance out the classes by reducing the number of observations in the dominant class. The objective is to have a representative sample from each class so that the model can make better predictions without being biased towards any specific class.

Benefits of Undersampling

Undersampling has several benefits that make it an important technique in machine learning. Some of these benefits include:

1. Improving the Accuracy of the Model

Undersampling helps to improve the accuracy of the model by reducing the bias towards the dominant class and providing an equal representation of classes in the dataset.

2. Enhancing the Model’s Precision and Recall

By balancing out the classes, undersampling helps to improve the precision and recall of the model.

3. Saving Computational Resources

Undersampling helps to reduce the size of the dataset, thus reducing the computational resources required to train the model.

How Undersampling Works

There are different approaches to undersampling, but the most common method is random selection. In this method, observations are randomly selected from the dominant class so that the number of observations in each class is the same. The model is then trained on the balanced dataset.

Another approach to undersampling is cluster-based sampling, where observations from the dominant class are grouped into clusters, and then some of the clusters are selected while the rest are discarded.


Undersampling is an important technique for machine learning that helps to balance out the representation of classes in a dataset. This technique improves the accuracy, precision, and recall of the model, and it is an effective way to address the class imbalance problem. It is important to choose an appropriate undersampling technique that best fits your dataset to maximize its benefits.