Automatically create a new object from GridSearchCV best_params_
I figured out, if you unpack the parameters it is doable, i.e if
best_par=RFC_grid_search.best_params_ then you can create the optimal RFC with the parameters in best_params_ by
rfc_opt=RFC(**best_part)
Assume I want to fit a random forest, RFC, and grid search using sklearns GridSearchCV.
We can get the best parameters using RFC.best_params_ but if I then want to create a random forest I need manually to write those parameters in e.g RFC(n_estimators=12,max_depth=7) afterwards. Is there a way,something like RFC_opt=RFC(best_params_) to do it automatically?