How to predict after tuning?

Hi, in this section, we learned how to use RandomizedSearchCV for hyperparameter tuning. But I didn’t figure out the optimal way to predict(using the best set of hyperparameters obtained from RandomizedSearchCV)! I considered two ways:

  1. After fitting RandomizedSearchCV on the training set, use best_params_ to find the optimal set of params and use them in fitting the Regression model(i.e.) on the training dataset.(handy and not automatic)

  2. just use RandomizedSearchCV.fit(data_train , target) and then RandomizedSearchCV.predict(data_test) to obtain prediction using optimal set of hyperparameters.(I guess this is automatic way)

Which one is true?

The second way is the usual one and would be used if you plug a RandomizedSearchCV within a cross-validation evaluation.

No fu*ck cross-validation! I didn’t talk about additional cross-validation. You’re adding surplus details to my question. I said, suppose I found the optimal set of hyperparameters for the model. Then the final goal is a prediction! not find the optional set of hyperparameters, and we do hyperparameter tuning for better performance in prediction. So how can I perform prediction using the optimal set of hyperparameters? Can I use the second approach?

Please mind your language.

Just trying to help here.

As mentioned: solution 2.

Sorry!

Thank you and I appreciate it. :smiling_face_with_three_hearts:

Thanks a lot.