Aan de slagGa gratis aan de slag

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 distributions
  • rfr: a random forest regression model
  • scorer: a scoring method to use

Deze oefening maakt deel uit van de cursus

Model Validation in Python

Cursus bekijken

Oefeninstructies

  • Load the method for conducting a random search in sklearn.
  • Complete a random search by filling in the parameters: estimator, param_distributions, and scoring.
  • Use 5-fold cross validation for this random search.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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=____)
Code bewerken en uitvoeren