Skip to content
Advertisement

Sklearn – Best estimator from GridSearchCV with refit = True

I’m trying to finds the best estimator using GridSearchCV and I’m using refit = True as per default. Given that the documentation states:

JavaScript

Should I do .fit on the training data afterwards as such:

JavaScript

Or should I do it like this instead:

JavaScript

Advertisement

Answer

You should do it like your first verison. You need to always call classifier.fit otherwise it doesn’t do anything. Refit=True means that it trains on the entire training set after the cross validation is done.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement