Oversampling Ratio Calculator
Calculate the oversampling ratio needed to balance minority classes in a dataset.
About Oversampling Ratio Calculator
Oversampling techniques like SMOTE generate synthetic minority-class samples to shrink the imbalance ratio toward a target value, without touching the majority class. This calculator computes the required new minority class size (majority ÷ target ratio) and the number of synthetic samples needed to reach it — the gap between the new target size and your current minority count.
Formulas
New minority size
new_minority = round(majority_count / target_ratio)
- majority_count
- Number of majority-class samples
- target_ratio
- Desired majority:minority ratio (e.g. 2 for 2:1)
Synthetic samples needed
synthetic_needed = new_minority - current_minority
- new_minority
- Target minority class size
- current_minority
- Current minority class size
Worked example
With the default values below, Oversampling Ratio Calculator returns New Minority Class Size of 4,750. 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 Minority Class Size
- 4,750
- Synthetic Samples Needed
- 4,250
- Current Imbalance Ratio
- 19.00 :1
Step by step
- 1Current ratio= 19.00 : 1
- 2New minority class size= 4750
- 3Synthetic samples to generate= 4250
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 2 decimal places, 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
Should I always aim for a 1:1 ratio?
Not necessarily — a moderate target ratio (e.g. 2:1 or 3:1) often generalizes better than forcing perfect balance, since heavy oversampling risks overfitting to synthetic minority patterns.
Does SMOTE just duplicate minority samples?
No — SMOTE generates new synthetic samples by interpolating between existing minority-class neighbors in feature space, rather than simple duplication, which tends to generalize better.
Should oversampling be applied before or after the train/test split?
Always oversample only the training set after splitting — oversampling before splitting leaks synthetic-derived information into the test set and inflates evaluation metrics.
Related Calculators
You might also need
- Undersampling Ratio CalculatorCommonly used together
- Class Imbalance Ratio CalculatorCommonly used together
- Stratified Split CalculatorCommonly used together
- Random Seed GeneratorAlso in Miscellaneous AI
- Sequence Truncation CalculatorAlso in Miscellaneous AI
- Dataset Split CalculatorAlso in Miscellaneous AI
