Hyperparameter Search: Grid¶
The grid
search method generates trials on a “grid” of hyperparameter
configurations and trains each trial for max_steps
steps. The user specifies
a set of values for each hyperparameter via the hyperparameters
field in the
experiment configuration. The
“grid” of hyperparameter configurations is generated by taking the product of these sets. For example,
if the set of values for three separate hyperparameters aparam
, bparam
,
and cparam
are specified as {0, 1, 2}
, {10, 20}
, and {"c"}
respectively, then the grid of tuples (aparam, bparam, cparam)
generated is:
(0, 10, "c")
(0, 20, "c")
(1, 10, "c")
(1, 20, "c")
(2, 10, "c")
(2, 20, "c")
The way the set of hyperparameter values is specified depends on the type of hyperparameter:
const
: The set of values contains just the single value. For example,cparam
above could be specified as aconst
hyperparameter withval: c
.categorical
: The set of values is exactly the set of categorical values. For example,bparam
above could be specified as acategorical
hyperparameter withvals: [10, 20]
.int
: The set ofcount
values is taken evenly from the range[minval, maxval]
, inclusive of endpoints. Ifcount
is larger than the number of integer values in the range, that is interpreted as the entire range of integers in[minval, maxval]
. For example,aparam
above could be specified as anint
hyperparameter withminval: 0
,maxval: 2
, andcount: 3
orcount: 100
.double
: The set ofcount
values is taken evenly from the range[minval, maxval]
, inclusive of endpoints. The set{0.1, 0.3, 0.5}
could be specified as adouble
hyperparameter withminval: 0.1
,maxval: 0.5
,count: 3
.log
: The set ofcount
values is taken logarithmically evenly from the range [baseminval, basemaxval], inclusive of endpoints. For example, the set{0.00001, 0.0001, 0.001}
could be specified as alog
hyperparameter withbase: 10
,minval: -5
,maxval: -3
, andcount: 3
.
Under the special case of count: 1
for int
, double
, or log
, the
midpoint (with rounding for int
and with base midpoint for log
) is
returned.