CalcWorldHub
Free online calculator · no signup

Class imbalance ratio calculator

Compare the largest and smallest class counts in a two-class dataset before model evaluation.

4,000 tools
Class imbalance ratio calculator — Class A examples, Class B examples and calculation method
Class imbalance ratio calculator: inputs and calculation method.

How to use this calculator

Compare the largest and smallest class counts in a two-class dataset before model evaluation.

  1. Enter Class A examples, Class B examples. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Data science calculation

How this calculation works

The imbalance ratio describes how many observations belong to the majority class for each observation in the minority class. The minority share adds context by showing its fraction of all labeled rows; neither statistic alone determines model quality.

Inputs and units

classA — Class A examples
Enter the number of labeled observations in the first class.
classB — Class B examples
Enter the number of labeled observations in the second class.

Formula

Displayed formula

Imbalance ratio = majority-class count ÷ minority-class count; minority share (%) = minority count ÷ total count × 100.

Method

Enter the labeled example counts for two classes. The calculator identifies the larger and smaller counts, then reports their ratio and the smaller class's share of the combined dataset.

Worked example

For 900 examples in one class and 100 in the other, the ratio is 900 ÷ 100 = 9:1 and the minority share is 100 ÷ 1,000 × 100 = 10%.

Assumptions and limits

This is a count summary for two classes only. It does not choose a resampling method, account for class costs, estimate generalization performance, or replace validation on representative data.

Frequently asked questions

What does a 9:1 imbalance ratio mean?

The majority class has nine times as many examples as the minority class in the entered two-class dataset.

Does a larger imbalance ratio prove a model is biased?

No. It describes class counts, not prediction behavior. Evaluate per-class metrics and use a validation set that reflects the intended population.

Can this calculate imbalance for more than two classes?

This calculator compares two classes. For multiple classes, compare each class count with the largest count or use a multiclass summary.

How do I use the Class imbalance ratio calculator?

Enter Class A examples, Class B examples. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Class imbalance ratio?

For 900 examples in one class and 100 in the other, the ratio is 900 ÷ 100 = 9:1 and the minority share is 100 ÷ 1,000 × 100 = 10%.