A Domain
object is a representation of a single dimension of a ParamSet
. Domain
objects are used to construct
ParamSet
s, either through the ps()
short form, or through the ParamSet
$search_space()
mechanism (see
to_tune()
). Domain
corresponds to a Param
object, except it does not have an $id
, and it does have a
trafo
and dependencies (depends
) associated with it. For each of the basic Param
classes (ParamInt
,
ParamDbl
, ParamLgl
, ParamFct
, and ParamUty
) there is a function constructing a Domain
object
(p_int()
, p_dbl()
, p_lgl()
, p_fct()
, p_uty()
). They each have the same arguments as the corresponding
Param
$new()
function, except without the id
argument, and with the the additional parameters trafo
, and
depends
.
Domain
objects are representations of parameter ranges and are intermediate objects to be used in short form
constructions in to_tune()
and ps()
. Because of their nature, they should not be modified by the user.
The Domain
object's internals are subject to change and should not be relid upon.
p_int( lower = Inf, upper = Inf, special_vals = list(), default = NO_DEF, tags = character(), depends = NULL, trafo = NULL, logscale = FALSE ) p_dbl( lower = Inf, upper = Inf, special_vals = list(), default = NO_DEF, tags = character(), tolerance = sqrt(.Machine$double.eps), depends = NULL, trafo = NULL, logscale = FALSE ) p_uty( default = NO_DEF, tags = character(), custom_check = NULL, depends = NULL, trafo = NULL ) p_lgl( special_vals = list(), default = NO_DEF, tags = character(), depends = NULL, trafo = NULL ) p_fct( levels, special_vals = list(), default = NO_DEF, tags = character(), depends = NULL, trafo = NULL )
lower  ( 

upper  ( 
special_vals  ( 
default  ( 
tags  (

depends  ( 
trafo  ( 
logscale  ( 
tolerance  ( 
custom_check  ( 
levels  ( 
A Domain
object.
The p_fct
function admits a levels
argument that goes beyond the levels
accepted by ParamFct
$new()
.
Instead of a character
vector, any atomic vector or list (optionally named) may be given. (If the value is a list
that is not named, the names are inferred using as.character()
on the values.) The resulting Domain
will
correspond to a range of values given by the names of the levels
argument with a trafo
that maps the character
names to the arbitrary values of the levels
argument.
params = ps( unbounded_integer = p_int(), bounded_double = p_dbl(0, 10), half_bounded_integer = p_dbl(1), half_bounded_double = p_dbl(upper = 1), double_with_trafo = p_dbl(1, 1, trafo = exp), extra_double = p_dbl(0, 1, special_vals = list("xxx"), tags = "tagged"), factor_param = p_fct(c("a", "b", "c")), factor_param_with_implicit_trafo = p_fct(list(a = 1, b = 2, c = list())) ) print(params)#> <ParamSet> #> id class lower upper nlevels default #> 1: unbounded_integer ParamInt Inf Inf Inf <NoDefault[3]> #> 2: bounded_double ParamDbl 0 10 Inf <NoDefault[3]> #> 3: half_bounded_integer ParamDbl 1 Inf Inf <NoDefault[3]> #> 4: half_bounded_double ParamDbl Inf 1 Inf <NoDefault[3]> #> 5: double_with_trafo ParamDbl 1 1 Inf <NoDefault[3]> #> 6: extra_double ParamDbl 0 1 Inf <NoDefault[3]> #> 7: factor_param ParamFct NA NA 3 <NoDefault[3]> #> 8: factor_param_with_implicit_trafo ParamFct NA NA 3 <NoDefault[3]> #> value #> 1: #> 2: #> 3: #> 4: #> 5: #> 6: #> 7: #> 8: #> Trafo is set.params$trafo(list( bounded_double = 1, double_with_trafo = 1, factor_param = "c", factor_param_with_implicit_trafo = "c" ))#> $bounded_double #> [1] 1 #> #> $double_with_trafo #> [1] 2.718282 #> #> $factor_param #> [1] "c" #> #> $factor_param_with_implicit_trafo #> list() #># logscale: params = ps(x = p_dbl(1, 100, logscale = TRUE)) # The ParamSet has bounds log(1) .. log(100): print(params)#> <ParamSet> #> id class lower upper nlevels default value #> 1: x ParamDbl 0 4.60517 Inf <NoDefault[3]> #> Trafo is set.# When generating a equidistant grid, it is equidistant within log values grid = generate_design_grid(params, 3) print(grid)#> <Design> with 3 rows: #> x #> 1: 0.000000 #> 2: 2.302585 #> 3: 4.605170#> [[1]] #> [[1]]$x #> [1] 1 #> #> #> [[2]] #> [[2]]$x #> [1] 10 #> #> #> [[3]] #> [[3]]$x #> [1] 100 #> #># Integer parameters with logscale are `ParamDbl`s pretrafo params = ps(x = p_int(0, 10, logscale = TRUE)) print(params)#> <ParamSet> #> id class lower upper nlevels default value #> 1: x ParamDbl 0.6931472 2.397895 Inf <NoDefault[3]> #> Trafo is set.#> <Design> with 4 rows: #> x #> 1: 0.6931472 #> 2: 0.3372003 #> 3: 1.3675478 #> 4: 2.3978953#> [[1]] #> [[1]]$x #> [1] 0 #> #> #> [[2]] #> [[2]]$x #> [1] 1 #> #> #> [[3]] #> [[3]]$x #> [1] 3 #> #> #> [[4]] #> [[4]]$x #> [1] 10 #> #>