Stratified Split Sizes Calculator
Work out stratified split sizes instantly with clear inputs, formula shown and shareable results.
About Stratified Split Sizes Calculator
Stratified splitting keeps the class ratio identical in every partition, which matters most when positives are rare: a random split of an 8 percent positive set can easily land a test fold with half the expected positives, making recall estimates swing wildly. The key sanity check is the absolute number of positives in the test set, not the percentage.
Formula
Stratified counts
test rows = rows x test share; test positives = test rows x positive rate; train positives = total positives - test positives
Worked example
With the default values below, Stratified Split Sizes Calculator returns Positive cases in the test set of 160. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Rows in the datasetminimum 10
- 10,000
- Positive class rateaccepts 0.01–99.99 %
- 8 %
- Test shareaccepts 1–50 %
- 20 %
Results
- Positive cases in the test set
- 160
- Test rows
- 2,000
- Positive cases in the training set
- 640
- Training rows
- 8,000
Step by step
- 1Values used
- 2Stratified counts
- 3Positive cases in the test set= 160
- 4Test rows= 2,000
- 5Positive cases in the training set= 640
- 6Training rows= 8,000
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 whole numbers, 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
How many positives does a test set need?
As a rule of thumb at least 50, and ideally a few hundred, before precision and recall are stable enough to compare models. Below about 20, confidence intervals are wider than most model differences.
Can I stratify on something other than the label?
Yes. Stratifying on a sensitive attribute or on time bucket as well as the label helps ensure the test set represents the population you care about.
Related Calculators
- Train Test Split Size Calculator
- A B Test For Models Calculator
- Active Learning Sample Budget Calculator
- Adjusted Rand Index Calculator
- AI Project ROI Calculator
- AIC And BIC Calculator
- Annotation QA Sample Size Calculator
- Annotation Time Calculator
- Anomaly Threshold (Z Score) Calculator
- ARIMA Order Selection Calculator
You might also need
- Train Test Split Size CalculatorAlso in AI, ML & Data Science
- AI Project ROI CalculatorAlso in AI, ML & Data Science
- Annotation Time CalculatorAlso in AI, ML & Data Science
- Distillation Speedup CalculatorAlso in AI, ML & Data Science
- Exponential Smoothing CalculatorAlso in AI, ML & Data Science
- FLOPs Estimate CalculatorAlso in AI, ML & Data Science
