Calculate the undersampling ratio needed to balance majority classes in a dataset.
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.
New majority size
new_majority = round(minority_count × target_ratio)
Samples removed
samples_removed = current_majority - new_majority
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.
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.
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.