Skip to content
ENExplore Calculators

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

  1. 1Values used
  2. 2Stratified counts
  3. 3Positive cases in the test set= 160
  4. 4Test rows= 2,000
  5. 5Positive cases in the training set= 640
  6. 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.

Stratified Split Sizes Calculator | Calcrivo