Question about RandomizedSearchCV and param_grid vs. param_distributions

Is there a reason param_grid is used here instead of param_distributions? I thought the point of RandomizedSearchCV was to search the hyperparameter space in a more random/grid-free manner.

In this case we wanted to show that RandomizedSearchCV can accept randomized parameters (in this case using randint(10, 30)) that will change through the different iterations, but also a set of given values that will be randomly chosen in combination with the other parameters. This is useful for using the same tool when some of your variables are continuous and some are not.

Maybe we can add a small paragraph to mention this during the exercise. Thanks for your feedback!

When you put parameters like that, does RandomizedSearchCV just become GridSearchCV? Also, the example of loguniform_int, would that have been equivalent to giving values {1, 10, 100} and RandomizedSearchCV chooses them uniformly? Thank you!

-Pritam

They behave similarly, but remember RandomizedSearchCV will choose a different random combination for each iteration. For instance, if you set n_iter=100 but you have a grid with 10 unique combinations, then you would be repeating combinations several times.

The loguniform_int class defined in the Hyperparameter tuning by randomized-search notebook is a scipy.stats.loguniform distribution that is rounded to the nearest integer. In such notebook we pass loguniform_int(2, 256), meaning that low value integers (2, 3, 4, etc.) will be chosen with higher probability and values near 256 will be rarely selected by random.