Deal with class imbalance (without generating synthetic samples): Clustering Based Bagging Algorithm (CBBA)

To deal with class imbalance, take a look at “In classification, how do you handle an unbalanced training set?”.

Definitely, the answers were very creative.

The rookie way to deal with class imbalance

The rookie’s way:

The approach of under-sampling the majority class is an effective method in dealing with classifying imbalanced data sets. But it has a deficiency of ignoring useful information.

I came across a paper on this:

Clustering Based Bagging Algorithm (CBBA)

In order to eliminate this deficiency, we propose a Clustering Based Bagging Algorithm (CBBA). In CBBA, we cluster the majority class into several groups. We randomly sample instances from each group. We combine those sampled instances together with the minority class instances. Then, we use them to train a base classifier. We produce the final by combining those classifiers. The experimental results show that our approach outperforms the under-sampling method.

If the answer still seems hazy, kindly read the below content. We would use different wordings to explain the concept.

The approaches are not hard. These are flexible. They provide room to be creative and depend on the dataset you are working with.

Explanation of Clustering-Based Bagging Algorithm (CBBA)

Wording 1:

Decompose your larger class into a smaller number of other classes. This is tricky and totally dependent on the kind of data you have. For something like 30 instances of A vs 4000 instances of B. You would decompose the 4000 instances of B into 1000 instances of B1 and 3000 instances of unknown. Effectively you are reducing the difference in the number of instances between A and B1.

Wording 2:

Divide the more abundant class into L distinct clusters. Then train L predictors, where we train each predictor on only one of the distinct clusters. But on all of the data from the rare class. To be clear, we use the data from the rare class in the training of all L predictors. Finally, use model averaging for the L learned predictors as your final predictor.


Running an ensemble of classifiers on these sets could produce a much better result than one classifier alone.

Check out the comments on the Reddit post Classification when 80% of my training set is of one class.

I highly recommend checking out this incredibly informative and engaging professional certificate Training by Google on Coursera:

Google Advanced Data Analytics Professional Certificate

There are 7 Courses in this Professional Certificate that can also be taken separately.

  1. Foundations of Data Science: Approx. 21 hours to complete. SKILLS YOU WILL GAIN: Sharing Insights With Stakeholders, Effective Written Communication, Asking Effective Questions, Cross-Functional Team Dynamics, and Project Management.
  2. Get Started with Python: Approx. 25 hours to complete. SKILLS YOU WILL GAIN: Using Comments to Enhance Code Readability, Python Programming, Jupyter Notebook, Data Visualization (DataViz), and Coding.
  3. Go Beyond the Numbers: Translate Data into Insights: Approx. 28 hours to complete. SKILLS YOU WILL GAIN: Python Programming, Tableau Software, Data Visualization (DataViz), Effective Communication, and Exploratory Data Analysis.
  4. The Power of Statistics: Approx. 33 hours to complete. SKILLS YOU WILL GAIN: Statistical Analysis, Python Programming, Effective Communication, Statistical Hypothesis Testing, and Probability Distribution.
  5. Regression Analysis: Simplify Complex Data Relationships: Approx. 28 hours to complete. SKILLS YOU WILL GAIN: Predictive Modelling, Statistical Analysis, Python Programming, Effective Communication, and regression modeling.
  6. The Nuts and Bolts of Machine Learning: Approx. 33 hours to complete. SKILLS YOU WILL GAIN: Predictive Modelling, Machine Learning, Python Programming, Stack Overflow, and Effective Communication.
  7. Google Advanced Data Analytics Capstone: Approx. 9 hours to complete. SKILLS YOU WILL GAIN: Executive Summaries, Machine Learning, Python Programming, Technical Interview Preparation, and Data Analysis.

It could be the perfect way to take your skills to the next level! When it comes to investing, there’s no better investment than investing in yourself and your education. Don’t hesitate – go ahead and take the leap. The benefits of learning and self-improvement are immeasurable.

You may also like:

Check out the table of contents for Product Management and Data Science to explore those topics.

Curious about how product managers can utilize Bhagwad Gita’s principles to tackle difficulties? Give this super short book a shot. This will certainly support my work.

Leave a Reply