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?
Best Answer
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:
- Solved – cv parameter in GridSearchCV doesn’t change accuracy
- Solved – Should I use GridSearchCV on all of the data? Or just the training set
- Solved – Should I use GridSearchCV on all of the data? Or just the training set
- Solved – Should I use GridSearchCV on all of the data? Or just the training set
- Solved – Should I use GridSearchCV on all of the data? Or just the training set