1

I'm using gridsearchcv to train a logistic regression classifier. What I want to know is whether the refit command re-selects features based on chosen hyper-parameter C, OR simply uses features selected in the cross-validation procedures and only re-fits the value of coefficients without re-selection of features?

THwang
  • 11
  • 4

1 Answers1

2

As per the documentation of GridSearchCV :

1. Refit an estimator using the best found parameters on the whole dataset.
2. The refitted estimator is made available at the best_estimator_ attribute and permits using predict directly on this GridSearchCV instance.

From here Confused with repect to working of GridSearchCV you can get below significance of refit parameter.

refit : boolean
    Refit the best estimator with the entire dataset. 
    If “False”, it is impossible to make predictions using 
    this GridSearchCV instance after fitting.
Rahul Singh
  • 184
  • 6
  • thank you so much! I have seen those answers but I am still confused. I think the algorithm should be constructing new objective function using selected hyper-parameter, thus all the features should be re-selected based on whole training sample. But I just want to make sure I understand it correctly. So refit command does re-select features right? – THwang Sep 04 '19 at 09:09
  • Your Understanding is almost correct. Actually if we are keeping "refit=True" then after grid search is completed then it will choose the best combination of parameters (estimator with maximum score or with minimum loss). and Retrain a model with Data you have provided and populate the "best_estimator_". – Rahul Singh Sep 04 '19 at 09:31