For each parameter type a special constructor function is available, see below.
For the following arguments you can also pass an expression
instead of a concrete value:
default
, len
, lower
, upper
, values
.
These expressions can depend on arbitrary symbols, which are later filled in / substituted from
a dictionary, in order to produce a concrete valu, see evaluateParamExpressions
.
So this enables data / context dependent settings, which is sometimes useful.
The S3 class is a list which stores these elements:
character(1)
]See argument of same name.
character(1)
]Data type of parameter. For all type string see getTypeStringsAll
integer(1)
| expression
]See argument of same name.
numeric
| expression
]See argument of same name. Length of this vector is len
.
numeric
| expression
]See argument of same name. Length of this vector is len
.
list
| expression
]Discrete values, always stored as a named list.
character
See argument of same name.
logical(1)
]See argument of same name.
NULL
| function(x)
]See argument of same name.
NULL
| expression
]See argument of same name.
expression
]See argument of same name.
logical(1)
]Extra flag to really be able to check whether the user passed a default, to avoid troubles with NULL
and NA
.
logical(1)
]See argument of same name.
list
]See argument of same name.
makeNumericParam(id, lower = -Inf, upper = Inf, allow.inf = FALSE,
default, trafo = NULL, requires = NULL, tunable = TRUE,
special.vals = list())makeNumericVectorParam(id, len, lower = -Inf, upper = Inf,
cnames = NULL, allow.inf = FALSE, default, trafo = NULL,
requires = NULL, tunable = TRUE, special.vals = list())
makeIntegerParam(id, lower = -Inf, upper = Inf, default,
trafo = NULL, requires = NULL, tunable = TRUE,
special.vals = list())
makeIntegerVectorParam(id, len, lower = -Inf, upper = Inf,
cnames = NULL, default, trafo = NULL, requires = NULL,
tunable = TRUE, special.vals = list())
makeLogicalParam(id, default, requires = NULL, tunable = TRUE,
special.vals = list())
makeLogicalVectorParam(id, len, cnames = NULL, default,
requires = NULL, tunable = TRUE, special.vals = list())
makeDiscreteParam(id, values, trafo = NULL, default, requires = NULL,
tunable = TRUE, special.vals = list())
makeDiscreteVectorParam(id, len, values, default, requires = NULL,
tunable = TRUE, special.vals = list())
makeFunctionParam(id, default = default, requires = NULL,
special.vals = list())
makeUntypedParam(id, default, requires = NULL, tunable = TRUE,
special.vals = list())
makeCharacterParam(id, default, requires = NULL, special.vals = list())
makeCharacterVectorParam(id, len, cnames = NULL, default,
requires = NULL, special.vals = list())
[character(1)
]
Name of parameter.
[numeric
| expression
]
Lower bounds.
A singe value of length 1 is automatically replicated to len
for vector parameters.
If len = NA
you can only pass length-1 scalars.
Default is -Inf
.
[numeric
| expression
]
Upper bounds.
A singe value of length 1 is automatically replicated to len
for vector parameters.
If len = NA
you can only pass length-1 scalars.
Default is Inf
.
[logical(1)
]
Allow infinite values for numeric and numericvector params to be feasible settings.
Default is FALSE
.
[any concrete value | expression
]
Default value used in learner.
Note: When this is a discrete parameter make sure to use a VALUE here, not the NAME of the value.
If this argument is missing, it means no default value is available.
[NULL
| function(x)
]
Function to transform parameter. It should be applied to the parameter value
before it is, e.g., passed to a corresponding objective function.
Function must accept a parameter value as the first argument and return a transformed one.
Default is NULL
which means no transformation.
[NULL
| call
| expression
]
States requirements on other parameters' values, so that setting
this parameter only makes sense if its requirements are satisfied (dependent parameter).
Can be an object created either with expression
or quote
,
the former type is auto-converted into the later.
Only really useful if the parameter is included in a ParamSet
.
Default is NULL
which means no requirements.
[logical(1)
]
Is this parameter tunable?
Defining a parameter to be not-tunable allows to mark arguments like, e.g., “verbose” or other purely technical stuff.
Note that this flag is most likely not respected by optimizing procedures unless stated otherwise.
Default is TRUE
(except for untyped
, function
, character
and characterVector
) which means it is tunable.
[list()
]
A list of special values the parameter can except which are outside of the defined range.
Default is an empty list.
[integer(1)
| expression
]
Length of vector parameter.
[character
]
Component names for vector params (except discrete).
Every function in this package that creates vector values for such a param, will name
that vector with cnames
.
[vector
| list
| expression
]
Possible discrete values. Instead of using a vector of atomic values,
you are also allowed to pass a list of quite “complex” R objects,
which are used as discrete choices. If you do the latter,
the elements must be uniquely named, so that the names can be used
as internal representations for the choice.
[Param
].
# NOT RUN {
makeNumericParam("x",lower = -1, upper = 1)
makeNumericVectorParam("x", len = 2)
makeDiscreteParam("y", values = c("a","b"))
makeCharacterParam("z")
# }
Run the code above in your browser using DataLab