Understanding grid search
Grid search is the simplest automated hyperparameter-tuning method that ever existed. Apart from the fancy name, grid search is basically just a nested for
loop that tests all possible hyperparameter values in the search space. Although many packages have grid search as one of their hyperparameter-tuning method implementations, it is super easy to write your own code from scratch to implement this method. The name grid comes from the fact that we have to test the whole hyperparameter space just like creating a grid, as illustrated in the following diagram.
Figure 3.2 – Grid search illustration
For example, let's say we want to perform hyperparameter tuning using the grid search method on a random forest. We decide to focus only on the number of estimators, splitting criterion, and maximum tree-depth hyperparameters. Then, we can specify a list of possible values for each of the hyperparameters. Let's say we define...