How Does Random Search Work
Learn the step-by-step procedures of the random search method to perform hyperparameter tuning.
We'll cover the following...
- Introduction
- 1. Define the hyperparameters for the ML model
- 2. Set the number of iterations for the random search
- 3. Create random combinations of hyperparameter values
- 4. Train the ML model using the randomly selected hyperparameters
- 5. Evaluate and record the performance of the ML model
- 6. Select the best-performing combination of hyperparameters
- 7. Retrain the model using the selected hyperparameters
Introduction
The following list outlines the optimization steps and procedures that the random search method must follow to find the combination of hyperparameter values that produce the best ML model performance:
Define the hyperparameters for the ML model.
Set the number of iterations for the random search.
Create random combinations of hyperparameter values.
Train the ML model using the randomly selected hyperparameters.
Evaluate and record the performance of the ML model.
Select the best-performing combination of hyperparameters.
1. Define the hyperparameters for the ML model
We start by specifying the range of values that each hyperparameter can take. In this step, we need to identify the hyperparameters of the ML algorithm we want to use and their function during the learning process. The easy way to do so is to read the documentation of the machine learning algorithm. For example, the logistic regression algorithm ...