Exam4Training

Which of the following changes can the data scientist make to accomplish the task?

A data scientist is attempting to tune a logistic regression model logistic using scikit-learn. They want to specify a search space for two hyperparameters and let the tuning process randomly select values for each evaluation.

They attempt to run the following code block, but it does not accomplish the desired task:

Which of the following changes can the data scientist make to accomplish the task?
A . Replace the GridSearchCV operation with RandomizedSearchCV
B . Replace the GridSearchCV operation with cross_validate
C . Replace the GridSearchCV operation with ParameterGrid
D . Replace the random_state=0 argument with random_state=1
E . Replace the penalty= [’12’, ’11’] argument with penalty=uniform (’12’, ’11’)

Answer: A

Explanation:

The user wants to specify a search space for hyperparameters and let the tuning process randomly select values. GridSearchCV systematically tries every combination of the provided hyperparameter values, which can be computationally expensive and time-consuming. RandomizedSearchCV, on the other hand, samples hyperparameters from a distribution for a fixed number of iterations. This approach is usually faster and still can find very good parameters, especially when the search space is large or includes distributions.

Reference

Scikit-Learn documentation on hyperparameter tuning: https://scikit-learn.org/stable/modules/grid_search.html#randomized-parameter-optimization

Exit mobile version