I\'m trying to understand using kfolds cross validation from the sklearn python module.
I understand the basic flow:
m
No the model is not fitted. Looking at the source code for cross_val_score:
scores=parallel(delayed(_fit_and_score)(clone(estimator),X,y,scorer, train,test,verbose,None,fit_params)
As you can see, cross_val_score
clones the estimator before fitting the fold training data to it. cross_val_score
will give you output an array of scores which you can analyse to know how the estimator performs for different folds of the data to check if it overfits the data or not. You can know more about it here
You need to fit the whole training data to the estimator once you are satisfied with the results of cross_val_score
, before you can use it to predict on test data.