A split can change the visible class mix before any validation or test metric is read. This lesson compares one drifting split with one stratified split using exact row counts.
highlighted = computed this step
Start with the class mix
The toy dataset has 8 rows: 2 positive and 6 negative. Each shown split uses 4 train rows and 4 test rows.
N=8,+=2,−=6
Unstratified split can drift
In the unstratified example, train has 0 positive out of 4 rows, while test has 2 positives out of 4 rows. The visible shares are 0 and 1/2.
train +=40=0,test +=42=1/2
Stratified split keeps the shown mix
In the stratified example, train has 1 positive out of 4 rows, and test also has 1 positive out of 4 rows. Both sides show positive share 1/4.
train +=41=1/4,test +=41=1/4
Boundary
This preserves the toy label mix before validation or test metrics are read. It is not a guarantee for future rows, NOT training, and NOT generalization.