parameter key), the methodology to search the parameter space (method key), and more.
The proceeding table lists top-level sweep configuration keys and a brief description. See the respective sections for more information about each key.
See the Sweep configuration structure for more information on how to structure your sweep configuration.
metric
Use the metric top-level sweep configuration key to specify the name, the goal, and the target metric to optimize.
parameters
In your YAML file or Python script, specify parameters as a top level key. Within the parameters key, provide the name of a hyperparameter you want to optimize. Common hyperparameters include: learning rate, batch size, epochs, optimizers, and more. For each hyperparameter you define in your sweep configuration, specify one or more search constraints.
The proceeding table shows supported hyperparameter search constraints. Based on your hyperparameter and use case, use one of the search constraints below to tell your sweep agent where (in the case of a distribution) or what (value, values, and so forth) to search or use.
W&B sets the following distributions based on the following conditions if a distribution is not specified:
categoricalif you specifyvaluesint_uniformif you specifymaxandminas integersuniformif you specifymaxandminas floatsconstantif you provide a set tovalue
method
Specify the hyperparameter search strategy with the method key. There are three hyperparameter search strategies to choose from: grid, random, and Bayesian search.
Grid search
Iterate over every combination of hyperparameter values. Grid search makes uninformed decisions on the set of hyperparameter values to use on each iteration. Grid search can be computationally costly. Grid search executes forever if it is searching within in a continuous search space.Random search
Choose a random, uninformed, set of hyperparameter values on each iteration based on a distribution. Random search runs forever unless you stop the process from the command line, within your python script, or the W&B App. Specify the distribution space with the metric key if you choose random (method: random) search.
Bayesian search
In contrast to random and grid search, Bayesian models make informed decisions. Bayesian optimization uses a probabilistic model to decide which values to use through an iterative process of testing values on a surrogate function before evaluating the objective function. Bayesian search works well for small numbers of continuous parameters but scales poorly. For more information about Bayesian search, see the Bayesian Optimization Primer paper. Bayesian search runs forever unless you stop the process from the command line, within your python script, or the W&B App.Distribution options for random and Bayesian search
Within theparameter key, nest the name of the hyperparameter. Next, specify the distribution key and specify a distribution for the value.
The proceeding tables lists distributions W&B supports.
early_terminate
Use early termination (early_terminate) to stop poorly performing runs. If early termination occurs, W&B stops the current run before it creates a new run with a new set of hyperparameter values.
You must specify a stopping algorithm if you use
early_terminate. Nest the type key within early_terminate within your sweep configuration.Stopping algorithm
W&B currently supports Hyperband stopping algorithm.
Specify either
min_iter or max_iter to create a bracket schedule.Hyperband checks which runs to end once every few minutes. The end run timestamp might differ from the specified brackets if your run or iteration are short.
command
Modify the format and contents with nested values within the command key. You can directly include fixed components such as filenames.
On Unix systems,
/usr/bin/env ensures that the OS chooses the correct Python interpreter based on the environment.