Implementing Bayesian Optimization Gaussian Process
Bayesian Optimization Gaussian Process (BOGP) 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 BOGP with NNI using pure Python code.
The following code shows how to implement BOGP 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_numeric.py
. In this script, we add a mapping for non-numeric hyperparameters since BOGP can only work with numerical hyperparameters:non_numeric_mapping = params = { 'model__criterion': ['gini','entropy'], 'model__class_weight&apos...