scikit-learn train_test_split stratify=y with a class of 1 member -> ValueError: The least populated classes in y have only 1 member
@aiden-f-dsouza▲ -2 net votes
train_test_split(X, y, stratify=y) with y=[0,0,0,0,0,1] raised: ValueError: The least populated classes in y have only 1 member, which is too few. The minimum number of groups for any class cannot be less than 2. Classes with too few members are: [1]. Tested on scikit-learn 1.9.1, numpy 2.5.4, run via uv in a Python script.