Solved – Should I use Cross Validation after GridSearchCv

I am a little bit confused with the grid search interface from scikit-learn. From examples I found snippets like that

clf = GridSearchCV(SVC(C=1), tuned_parameters, cv=5,                    scoring='%s_weighted' % score) clf.fit(X_train, y_train) 

I imagine what when calling fit the exhaustive search happens and then the estimator is being fitted with the best parameters that were found.

My question is, after I call fit can I go on and call predict or is my estimator considered overfit in this case? Should I create another estimator using the best parameters and then perform a cross_validation to see what it actually scores?

Looking at the docs the fit description says "Run fit on the estimator with randomly drawn parameters"

Actually sklearn.grid_search.GridSearchCV.fit()'s docstring is "Run fit with all sets of parameters".

My second question is, after I call fit can I go on and call predict

Yes.

Similar Posts:

Rate this post

Leave a Comment