# NOT RUN {
pars = ps(
a = p_int(0, 10),
b = p_int(upper = 20),
c = p_dbl(),
e = p_fct(letters[1:3]),
f = p_uty(custom_check = checkmate::check_function)
)
print(pars)
pars = ps(
a = p_dbl(0, 1, trafo = exp),
b = p_dbl(0, 1, trafo = exp),
.extra_trafo = function(x, ps) {
x$c <- x$a + x$b
x
}
)
# See how the addition happens after exp()ing:
pars$trafo(list(a = 0, b = 0))
pars$values = list(
a = to_tune(ps(x = p_int(0, 1),
.extra_trafo = function(x, param_set) list(a = x$x)
)),
# make 'y' depend on 'x', but they are defined in different ParamSets
# Therefore we need to allow dangling dependencies here.
b = to_tune(ps(y = p_int(0, 1, depends = x == 1),
.extra_trafo = function(x, param_set) list(b = x$y),
.allow_dangling_dependencies = TRUE
))
)
pars$search_space()
# }
Run the code above in your browser using DataLab