Skip to content
Calcrivo

Undersampling Ratio Calculator

Calculate the reduced majority-class size after undersampling to reach a target class ratio, keeping the minority class unchanged.

Inputs

samples
samples

e.g. 1 = fully balanced (1:1); 2 = majority is 2x minority after resampling.

New Majority Class Size

1,000

Samples Removed

8,500

Total Data Retained

15.0%

Step by step

  1. Current ratio

    9500 ÷ 500

    = 19.00 : 1

  2. New majority class size

    500 × 2

    = 1000

  3. Samples removed

    9500 − 1000

    = 8500

How it works

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

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.

You might also need