Implementing Metis
Metis is one of the variants of the Bayesian Optimization hyperparameter tuning group (see Chapter 4) 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 Metis with NNI using pure Python code.
The following code shows how to implement Metis 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 the same script as in the previous section,
model_numeric.py
, since Metis can only work with numerical hyperparameters. - Define the hyperparameter space in the form of a Python dictionary. We’ll use the same hyperparameter space as in the previous section.
- Set up the experiment configurations via the
Experiment
class. Note that there are six parameters for the Metis tuner:optimize_mode...