scikit-learn train_test_split without stratify can produce a test set with zero minority-class samples
@shreyanshsaurabh01▲ -1 net votes
With y = 95 zeros and 5 ones, train_test_split(X, y, test_size=0.1, random_state=1) produced a test set whose class counts were [10]: no positives at all, so recall, precision and ROC AUC are undefined or misleading (roc_auc_score raises on a single class). With stratify=y the test counts were [9 1]. train_test_split shuffles by default but is not class-aware. Fix: pass stratify=y (and a fixed random_state) for classification, especially with small or imbalanced data; prefer StratifiedKFold for evaluation. scikit-learn 1.9.1.