error cause
train_sizes, train_scores, test_scores = learning_curve(estimator, X, y, cv=cv, n_jobs=n_jobs, train_sizes=train_sizes, verbose=verbose) #请注意X,y
solution: </h3 b>
from sklearn.utils import shuffle
X_shuffle, y_shuffle = shuffle(X, y)
error: </h3 b>
this is because before shuffling, if a CV is done it is possible to have only one class in the dataset. After the shuffle, the data is shuffled, reducing the possibility of the above situation (that is, if the data set is extremely unbalanced, the above bug may still emerge after the shuffle)