Class Imbalance Ratio Calculator
Calculate the imbalance ratio between majority and minority classes in a dataset.
About Class Imbalance Ratio Calculator
The class imbalance ratio divides the majority class count by the minority class count, giving a single number that summarizes how skewed a classification dataset is. A ratio below 3:1 is generally considered mild and often trainable without special handling, while ratios above 10:1 typically require resampling, class weighting, or specialized loss functions (e.g. focal loss) to prevent the model from simply predicting the majority class.
Formula
imbalance_ratio = majority_class_count / minority_class_count
- majority_class_count
- Number of samples in the majority class
- minority_class_count
- Number of samples in the minority class
Worked example
With the default values below, Class Imbalance Ratio Calculator returns Imbalance Ratio of 19.00. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Majority Class Countaccepts 1–1,000,000,000 samples
- 9,500 samples
- Minority Class Countaccepts 1–1,000,000,000 samples
- 500 samples
Results
- Imbalance Ratio
- 19.00 :1
- Minority Class Share
- 5.00 %
- Concern Level
- Severe — resampling/weighting strongly recommended
Step by step
- 1Imbalance ratio= 19.00 : 1
- 2Minority class share of total= 5.00%
Assumptions and limits
- The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
At what ratio should I start worrying?
Most practitioners start applying mitigation techniques around a 10:1 ratio, though the right threshold depends on how costly minority-class errors are for your application (e.g. fraud or disease detection tolerate less imbalance).
Does accuracy still make sense at high imbalance?
No — at high imbalance, a model predicting only the majority class can achieve high accuracy while being useless; use precision, recall, F1, or AUPRC instead.
What can I do about severe imbalance?
Common approaches include oversampling the minority class (SMOTE), undersampling the majority class, class-weighted loss functions, or reframing the problem as anomaly detection.
