S3 methods
as.data.table()
Param ->data.table::data.table()
Converts param todata.table::data.table()
with 1 row. See ParamSet.
Public fields
id
(
character(1)
)
Identifier of the object.description
(
character(1)
)
String to describe this parameter. Used, for example, inmlr3misc::rd_info()
to automatically generate documentation for parameter sets.special_vals
(
list()
)
Arbitrary special values this parameter is allowed to take.default
(
any
)
Default value.tags
(
character()
)
Arbitrary tags to group and subset parameters.
Active bindings
class
(
character(1)
)
R6 class name. Read-only.is_number
(
logical(1)
)TRUE
if the parameter is of type"dbl"
or"int"
.is_categ
(
logical(1)
)TRUE
if the parameter is of type"fct"
or"lgl"
.has_default
(
logical(1)
)
Is there a default value?
Methods
Method new()
Creates a new instance of this R6 class.
Note that this object is typically constructed via derived classes, e.g., ParamDbl.
Usage
Param$new(id, special_vals, default, tags)
Arguments
id
(
character(1)
)
Identifier of the object.special_vals
(
list()
)
Arbitrary special values this parameter is allowed to take, to make it feasible. This allows extending the domain of the parameter. Note that these values are only used in feasibility checks, neither in generating designs nor sampling.default
(
any
)
Default value. Can be from the domain of the parameter or an element ofspecial_vals
. Has value NO_DEF if no default exists.NULL
can be a valid default. The value has no effect onParamSet$values
or the behavior ofParamSet$check()
,$test()
or$assert()
. Thedefault
is intended to be used for documentation purposes. `tags
(
character()
)
Arbitrary tags to group and subset parameters. Some tags serve a special purpose:"required"
implies that the parameters has to be given when settingvalues
in ParamSet.
Method check()
checkmate-like check-function. Take a value from the domain of the
parameter, and check if it is feasible. A value is feasible if it is of
the same storage_type
, inside of the bounds or element of
special_vals
.
Method assert()
checkmate-like assert-function. Take a value from the domain of
the parameter, and assert if it is feasible. A value is feasible if it
is of the same storage_type
, inside of the bounds or element of
special_vals
.
Method test()
checkmate-like test-function. Take a value from the domain of the
parameter, and test if it is feasible. A value is feasible if it is of
the same storage_type
, inside of the bounds or element of
special_vals
.
Method rep()
Repeats this parameter n-times (by cloning). Each parameter is named "[id]rep[k]" and gets the additional tag "[id]_rep".
Method print()
Printer.
Usage
Param$print(
...,
hide_cols = c("nlevels", "is_bounded", "special_vals", "tags", "storage_type")
)
Arguments
...
(ignored).
hide_cols
(
character()
)
Which fields should not be printed? Default is"nlevels"
,"is_bounded"
,"special_vals"
,"tags"
, and"storage_type"
.
Method qunif()
Takes values from [0,1] and maps them, regularly distributed, to the domain of the parameter. Think of: quantile function or the use case to map a uniform-[0,1] random variable into a uniform sample from this param.
Method convert()
Converts a value to the closest valid param. Only for values that
pass $check()
and mostly used internally.