Implementing RandomizedSearchCV
You are hoping that using a random search algorithm will help you improve predictions for a class assignment. You professor has challenged your class to predict the overall final exam average score.
In preparation for completing a random search, you have created:
param_dist
: the hyperparameter distributionsrfr
: a random forest regression modelscorer
: a scoring method to use
This exercise is part of the course
Model Validation in Python
Exercise instructions
- Load the method for conducting a random search in
sklearn
. - Complete a random search by filling in the parameters:
estimator
,param_distributions
, andscoring
. - Use 5-fold cross validation for this random search.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Import the method for random search
from sklearn.model_selection import ____
# Build a random search using param_dist, rfr, and scorer
random_search =\
____(
estimator=___,
param_distributions=____,
n_iter=10,
cv=____,
scoring=____)