makeParamSet: Construct from a bunch of parameters.

Multiple sets can be concatenated with c.

The constructed S3 class is simply a list that contains the element pars. pars is a list of the passed parameters, named by their ids.

If keys are provided it will automatically be checked whether all expressions within the provided parameters only contain arguments that are a subset of keys.

makeParamSet(..., params = NULL, forbidden = NULL, keys = NULL)

makeNumericParamSet(id = "x", len, lower = -Inf, upper = Inf, vector = TRUE)

Arguments

...

(Param())
Parameters.

params

(list of Param())
List of parameters, alternative way instead of using ....

forbidden

(NULL | R expression)
States forbidden region of parameter set via an expression. Every setting which satisfies this expression is considered to be infeasible. This makes it possible to exclude more complex region of the parameter space than through simple constraints or requires-conditions (although these should be always used when possible). If parameters have associated trafos, the forbidden region must always be specified on the original scale and not the transformed one. Default is NULL which means no forbidden region.

keys

character
Character vector with keys (names) of feasible variable names which will be provided via a dictionary/hash later. Default is NULL.

id

(character(1))
Name of parameter.

len

(integer(1))
Length of vector.

lower

(numeric)
Lower bound. Default is -Inf.

upper

numeric
Upper bound. Default is Inf.

vector

(logical(1))
Should a NumericVectorParam be used instead of n NumericParam objects? Default is TRUE.

Value

ParamSet() | LearnerParamSet. If all parameters of the ParamSet are learner parameters, the output will inherit the class LearnerParamSet.

Examples

makeParamSet(
  makeNumericParam("u", lower = 1),
  makeIntegerParam("v", lower = 1, upper = 2),
  makeDiscreteParam("w", values = 1:2),
  makeLogicalParam("x"),
  makeDiscreteVectorParam("y", len = 2, values = c("a", "b"))
)
#>             Type len Def   Constr Req Tunable Trafo
#> u        numeric   -   - 1 to Inf   -    TRUE     -
#> v        integer   -   -   1 to 2   -    TRUE     -
#> w       discrete   -   -      1,2   -    TRUE     -
#> x        logical   -   -        -   -    TRUE     -
#> y discretevector   2   -      a,b   -    TRUE     -
makeParamSet(
  makeNumericParam("u", lower = expression(ceiling(n))),
  makeIntegerParam("v", lower = expression(floor(n)), upper = 2),
  keys = c("p", "n")
)
#>      Type len Def            Constr Req Tunable Trafo
#> u numeric   -   - ceiling(n) to Inf   -    TRUE     -
#> v integer   -   -     floor(n) to 2   -    TRUE     -
makeParamSet(
  makeNumericParam("min", lower = 0, upper = 0.8),
  makeNumericParam("max", lower = 0.2, upper = 1),
  forbidden = expression(min > max)
)
#>        Type len Def   Constr Req Tunable Trafo
#> min numeric   -   - 0 to 0.8   -    TRUE     -
#> max numeric   -   - 0.2 to 1   -    TRUE     -
#> Forbidden region specified.