Cookie Consent
Hi, this website uses essential cookies to ensure its proper operation and tracking cookies to understand how you interact with it. The latter will be set only after consent.
Read our Privacy Policy
VOCABULARY

Class Imbalance

Class imbalance is a term given to a situation in a supervised machine learning problem where the classes are not equally distributed. Basically, this implies that there are unequal numbers of instances or cases for different classes in the data set. This is a common problem in machine learning classification where there are a disproportionate ratio of observations in each class. Class imbalance can be binary or multi-class. Binary imbalance is when one of the two classes has significantly more instances, whereas multi-class imbalance is when one or more classes have a higher number of instances than the rest.

Class imbalance can significantly impact the learning stage of a model. Machine learning algorithms are often designed to maximize the overall accuracy, which could be significantly influenced by the majority class and lead to the minority class being overlooked. For example, if 95% of the instances belong to class A in a binary classification problem (with class A and class B), and only 5% belong to class B, a naive classifier could simply classify all instances as class A and still achieve a 95% accuracy rate.

In such scenarios, traditional algorithms can be less effective as they are biased towards the majority class, thereby ignoring the minority class which could be the point of interest. To accommodate for this, different techniques are employed, including under-sampling the majority class, oversampling the minority class, changing the algorithm to focus more on the minority class, or using a combination of these. The aim of these techniques is to produce a balanced dataset or adjust the classification algorithm in order to reduce bias.

Therefore, it's crucial to pay special attention in handling class imbalance problems to ensure a more accurate and fair prediction model.

Lakera LLM Security Playbook
Learn how to protect against the most common LLM vulnerabilities

Download this guide to delve into the most common LLM security risks and ways to mitigate them.

Related terms
Activate
untouchable mode.
Get started for free.

Lakera Guard protects your LLM applications from cybersecurity risks with a single line of code. Get started in minutes. Become stronger every day.

Join our Slack Community.

Several people are typing about AI/ML security. 
Come join us and 1000+ others in a chat that’s thoroughly SFW.