When I am doing cross validation using Python's Sklearn and take the score of different metrics (accuracy, precision, etc.) like this:
result_accuracy = cross_val_score(classifier, X_train, y_train, scoring='accuracy', cv=10)
result_precision = cross_val_score(classifier, X_train, y_train, scoring='precision', cv=10)
result_recall = cross_val_score(classifier, X_train, y_train, scoring='recall', cv=10)
result_f1 = cross_val_score(classifier, X_train, y_train, scoring='f1', cv=10)
Did every execution of cross_val_score()
function for different metrics made the same 10 folds of the training data or not? If not, do I need to make the general 10-folds first using KFold, like this:
seed = 7
kf = KFold(n_splits=10, random_state=seed)
result_accuracy = cross_val_score(classifier, X_train, y_train, scoring='accuracy', cv=kf)
result_precision = cross_val_score(classifier, X_train, y_train, scoring='precision', cv=kf)
result_recall = cross_val_score(classifier, X_train, y_train, scoring='recall', cv=kf)
result_f1 = cross_val_score(classifier, X_train, y_train, scoring='f1', cv=kf)