Class Imbalance Ratio Calculator
For data scientists checking a classification dataset before training. You get the number of classes, total samples, the largest to smallest imbalance ratio, the majority baseline accuracy and each class share.
Close the gaps with real-world projects
Build industry projects on ByteLabs and add verified proof of your skills to your public profile.
How to use the Class Balance
- Enter class counts as label: count, one per line, or just the counts.
- Click Analyze balance.
- Read the imbalance ratio and majority baseline accuracy.
- Check each class share in the table below.
An example, step by step (example only)
You enter
cat: 900, dog: 90, bird: 10
The tool shows
3 classes, total 1,000, imbalance ratio 90 : 1, majority baseline 90%; shares 90%, 9%, 1%
Questions about the Class Balance
What is the majority class baseline?
It is the accuracy you get by always predicting the largest class. Here 900 of 1,000 samples gives 90 percent, so a model must beat that to add value.
What imbalance ratio counts as severely imbalanced?
There is no fixed cutoff, but ratios beyond about 10 to 1 usually need attention, and 100 to 1 or more calls for metrics like F1 or PR-AUC instead of accuracy.
How do I handle class imbalance?
Common options are class weights in the loss, resampling (oversampling the minority or undersampling the majority), synthetic samples such as SMOTE, and threshold tuning.
Is the Class Balance free and private?
Yes. It is free, needs no sign-up and runs entirely in your browser, so what you type is not uploaded. You only sign in if you want to email a result to yourself or save it to your CareerByteCode profile.