Skip to content
Calcrivo

Class Imbalance Ratio Calculator

Calculate the imbalance ratio between majority and minority classes and see if it exceeds common concern thresholds.

Inputs

samples
samples

Imbalance Ratio

19.00:1

Minority Class Share

5.00%

Concern Level

Severe — resampling/weighting strongly recommended

Step by step

  1. Imbalance ratio

    9500 ÷ 500

    = 19.00 : 1

  2. Minority class share of total

    500 ÷ (9500 + 500)

    = 5.00%

How it works

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

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.

You might also need