A Bayesian Optimization/ Tree Structured Parzen Estimator approach to Hyperparameter Tuning

  • especially useful for tuning architecture hyperparameters as well as standard hyperparams like learning rate etc.
    • allows you to set up conditional search spaces where dependent structural configurations (e.g., matching head dimensions to total hidden width) are evaluated based on the performance of past trials.

Page Content

Eager search Spaces

Automated search for optimal hyperparameters using Python conditionals, loops, and syntax

Easy Parallelization

Parallelize hyperparameter searches over multiple threads or processes without modifying code

Code Examples

A simple optimization problem:

  1. Define objective function to be optimized. Let’s minimize (x - 2)^2
  2. Suggest hyperparameter values using trial object. Here, a float value of x is suggested from -10 to 10
  3. Create a study object and invoke the optimize method over 100 trials
Python

You can optimize PyTorch hyperparameters, such as the number of layers and the number of hidden nodes in each layer, in three steps:

  1. Wrap model training with an objective function and return accuracy
  2. Suggest hyperparameters using a trial object
  3. Create a study object and execute the optimization
Python

You can optimize Scikit-Learn hyperparameters, such as the C parameter of SVC and the max_depth of the RandomForestClassifier, in three steps:

  1. Wrap model training with an objective function and return accuracy
  2. Suggest hyperparameters using a trial object
  3. Create a study object and execute the optimization
Python