Skip to content Skip to sidebar Skip to footer

Confused With Repect To Working Of Gridsearchcv

GridSearchCV implements a fit method in which it performs n-fold cross validation to determine best parameters. After this we can directly apply the best estimator to the testing d

Solution 1:

If you want to use predict, you'll need to set 'refit' to True. From the documentation:

refit : boolean
    Refit the best estimator with the entire dataset. 
    IfFalse”, it is impossible to make predictions using 
    this GridSearchCV instance after fitting.

It looks like it is true by default, so in the example, predict is based on the whole training set.

Post a Comment for "Confused With Repect To Working Of Gridsearchcv"