Implementing Hyper Band
Hyper Band is one of the variants of the Multi-Fidelity Optimization hyperparameter tuning group (see Chapter 6) that the NNI package can implement. Let’s use the same data, pipeline, and hyperparameter space as in the example in the previous section to implement Hyper Band with NNI using pure Python code.
The following code shows how to implement Hyper Band with the NNI package using pure Python code. You can find the more detailed code in the GitHub repository mentioned in the Technical requirements section:
- Prepare the model to be tuned in a script. Here, we’ll use a new script called
model_advisor.py
. In this script, we utilize theTRIAL_BUDGET
value from the output ofnni.get_next_parameter()
to update the'model__n_estimators'
hyperparameter. - Define the hyperparameter space in the form of a Python dictionary. We’ll use a similar hyperparameter space to the Implementing Grid Search section but we will remove...