Skip to content
ENExplore Calculators

Undersampling Ratio Calculator

Calculate the undersampling ratio needed to balance majority classes in a dataset.

About Undersampling Ratio Calculator

Undersampling reduces the majority class to a target size while keeping the minority class untouched, shrinking the overall dataset but balancing the class ratio. This calculator computes the new majority class size as minority count × target ratio, and reports how many majority-class samples must be removed and what fraction of the total dataset remains — a key tradeoff since undersampling discards potentially useful data.

Formulas

New majority size

new_majority = round(minority_count × target_ratio)

minority_count
Number of minority-class samples
target_ratio
Desired majority:minority ratio

Samples removed

samples_removed = current_majority - new_majority

current_majority
Current majority class size
new_majority
Target majority class size

Worked example

With the default values below, Undersampling Ratio Calculator returns New Majority Class Size of 1,000. 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
Target Ratio (majority : minority)accepts 1–1,000
2

Results

New Majority Class Size
1,000
Samples Removed
8,500
Total Data Retained
15.0 %

Step by step

  1. 1Current ratio= 19.00 : 1
  2. 2New majority class size= 1000
  3. 3Samples removed= 8500

Assumptions and limits

  • The result is derived only from the 3 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 1 decimal place, 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

When is undersampling preferable to oversampling?

Undersampling is attractive when you have an abundance of majority-class data and want faster training with no synthetic data, but it risks discarding informative majority-class examples.

How much data loss is too much?

If undersampling would discard more than ~50-70% of your majority class, consider combining it with some oversampling of the minority class instead of undersampling alone.

Which majority samples should be removed?

Random undersampling removes samples uniformly at random; more advanced methods (e.g. Tomek links, NearMiss) selectively remove majority samples near the decision boundary to preserve information.

Undersampling Ratio Calculator | Calcrivo