MulaiMulai sekarang secara gratis

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_list which is a list of combinations of learn_rate and min_samples_leaf for 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))

Latihan ini adalah bagian dari kursus

Hyperparameter Tuning in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Sample grid coordinates
grid_combinations_chosen = ____[0:____]

# Print result
print(____)
Edit dan Jalankan Kode