from sklearn datasets import load_iris iris load_iris(print("iris labels:\ {}format(iris target)out[ ]iris labels[ as you can seethe first third of the data is the class the second third is the class and the last third is the class imagine doing three-fold cross-validation on this dataset the first fold would be only class so in the first split of the datathe test set would be only class and the training set would be only classes and as the classes in training and test sets would be different for all three splitsthe three-fold cross-validation accuracy would be zero on this dataset that is not very helpfulas we can do much better than accuracy on iris as the simple -fold strategy fails herescikit-learn does not use it for classificationbut rather uses stratified -fold cross-validation in stratified cross-validationwe split the data such that the proportions between classes are the same in each fold as they are in the whole datasetas illustrated in figure - in[ ]mglearn plots plot_stratified_cross_validation(figure - comparison of standard cross-validation and stratified cross-validation when the data is ordered by class label cross-validation