Implementing Tree-structured Parzen Estimators
Tree-Structured Parzen Estimators (TPE) is one of the variants of the Bayesian Optimization hyperparameter tuning group (see Chapter 4, Exploring Bayesian Optimization) that is also implemented in the Hyperopt
package. To perform hyperparameter tuning with this method, we can follow a similar procedure as in the previous section by only changing the algo
parameter to tpe.suggest
in Step 4. The following code shows how to perform hyperparameter tuning with TPE in Hyperopt
:
from hyperopt import fmin, tpe
best = fmin(objective,
space=hyperparameter_space,
algo=tpe.suggest,
max_evals=100,
rstate=np.random.default_rng(0),
...