Stratified sampling creates data splits that preserve the original proportion of each class. If the dataset is 99% A and 1% B, each split aims to retain those percentages instead of allowing random variation to distort evaluation. section 4.2.1
Use it for imbalanced classification, where a model can appear accurate by predicting only the majority class. Preserving class ratios makes train/test comparisons more representative. section 4.2.1
Language classification split
For a name-language dataset, replace an unchecked random train/test split with a stratified split so every language remains represented in similar proportions. Stratified sampling is available through scikit-learn. section 4.2.1

