Grid and Random Search Side by Side
Visualizing the search space of random and grid search together allows you to easily see the coverage that each technique has and therefore brings to life their specific advantages and disadvantages.
In this exercise, you will sample hyperparameter combinations in a grid search way as well as a random search way, then plot these to see the difference.
You will have available:
combinations_listwhich is a list of combinations oflearn_rateandmin_samples_leaffor this algorithm- The function
visualize_search()which will make your hyperparameter combinations into X and Y coordinates and plot both grid and random search combinations on the same graph. It takes as input two lists of hyperparameter combinations.
If you wish to view the visualize_search() function definition, you can run this code:
import inspect
print(inspect.getsource(visualize_search))
Deze oefening maakt deel uit van de cursus
Hyperparameter Tuning in Python
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Sample grid coordinates
grid_combinations_chosen = ____[0:____]
# Print result
print(____)