Skip to contents

Declares that a hyperparameter should be searched over rather than set. It is the only way to express a search space: a bare vector is always a value, so nothing has to be inferred from how many elements it happens to have.

Usage

tune_over(...)

Arguments

...

The candidates to search over: one per argument, or a single list or vector read against the type the hyperparameter declares.

Value

HyperparameterCandidates object.

Details

Give it the candidates. Several arguments are one candidate each; a single argument holding several values is the candidates, so a grid you computed can be passed straight in:

setup_LightRF(max_depth = tune_over(3L, 4L, 5L))
setup_LightRF(lambda_l2 = tune_over(10^seq(-4, 0, length.out = 5)))
setup_MLP(hidden_units = tune_over(c(12L, 6L, 2L), c(14L, 12L, 6L, 2L)))

For a vector-valued hyperparameter one candidate is itself a vector, so pass the candidates as separate arguments or as a list – tune_over(list(c(12L, 6L), c(24L, 12L))). A single bare vector there would be one architecture rather than a search, and is an error saying so; nothing is guessed.

Passing it to a hyperparameter that is not tunable is an error: that hyperparameter accepts a value only.

Author

EDG

Examples

hp <- setup_LightRF(max_depth = tune_over(3L, 4L, 5L))
hp@max_depth
#> <tune> 3, 4, 5 
# A bare vector is a value, never a search space.
setup_LightRF(max_depth = 3L)@max_depth
#> [1] 3