pSS, short for “ParamSet Sugar”, is a shorthand API for makeParamSet which enables entry of ParamSets in short form. It behaves similarly to makeParamSet, but instead of having to construct each parameter individually, the parameters can be given in shorthand form with a convenient syntax, making use of R's nonstandard evaluation.

This makes definition of ParamSets shorter and more readable.

The difference between pSS and pSSLrn is only in the default value of .pss.learner.params being FALSE for the former and TRUE for the latter.

pSS(..., .pss.learner.params = FALSE, .pss.env = parent.frame())

pSSLrn(..., .pss.learner.params = TRUE, .pss.env = parent.frame())

Arguments

...

Parameters, see Details below.

.pss.learner.params

[logical]
Whether to create LearnerParam instead of Param objects. Default is TRUE for pSSLrn and FALSE for pSS.

.pss.env

[environment]
Which environment to use when evaluating expressions. Defaults to the calling function's frame.

Details

The arguments are of the form

name = default: type range [^ dimension] [settings].

name is any valid R identifier name.

= default Determines the 'default' setting in makeXXXParam. Note that this is different from an R function parameter default value, in that it serves only as information to the user and does not set the parameter to this value if it is not given. To define ‘no default’, use NA or leave the “= default” part out. Leaving it out can cause problems when R's static type checker verifies a package, so this is only recommended for interactive sessions and top-level applications. (To actually set a parameter default to NA, use (NA) in parentheses)

type is one of “integer”, “numeric”, “logical”, “discrete”, “funct”, “character”, “untyped”. Each of these types leads to a Param or LearnerParam of the given type to be created. Note that “character” is not available if ‘Learner’-parameters are created.

range is optional and only used for integer, numeric, and discrete parameters. For “discrete”, it is either [valuelist] with valuelist evaluating to a list, or of the form [value1, value2, ...], creating a discrete parameter of character or numeric values according to value1, value2 etc. If type is one of “integer” or “numeric”, range is of the form [lowBound, upBound], where lowBound and upBound must either be numerical (or integer) values indicating the lower and upper bound, or may be missing (indicating the absence of a bound). To indicate an exclusive bound, prefix the values with a tilde (“~”). For a “numeric” variable, to indicate an unbounded value which may not be infinite, you can use ~Inf or ~-Inf, or use tilde-dot (“~.”).

^ dimension is optionally determining the dimension of a ‘vector’ parameter. If it is absent, the result is a normal Param or LearnerParam, if it is present, the result is a Vector(Learner)Param. Note that a one-dimensional Vector(Learner)Param is distinct from a normal (Learner)Param.

settings may be a collection of further settings to supply to makeXXXParam and is optional. To specify one or more settings, put in double square brackets ([[, ]]), and comma-separate settings if more than one is present.

Examples

pSSLrn(a = NA: integer [~0, ]^2 [[requires = expression(b != 0)]], b = -10: numeric [~., 0], c: discrete [x, y, 1], d: logical, e: integer)
#> Type len Def Constr Req Tunable Trafo #> a integervector 2 - 1 to Inf Y TRUE - #> b numeric - -10 -Inf to 0 - TRUE - #> c discrete - - x,y,1 - TRUE - #> d logical - - - - TRUE - #> e integer - - -Inf to Inf - TRUE -
# is equivalent to makeParamSet( makeIntegerVectorLearnerParam("a", len = 2, lower = 1, # note exclusive bound upper = Inf, requires = expression(b != 0)), makeNumericLearnerParam("b", lower = -Inf, upper = 0, allow.inf = FALSE, default = -10), # note infinite value is prohibited. makeDiscreteLearnerParam("c", values = list(x = "x", y = "y", `1` = 1)), makeLogicalLearnerParam("d"), makeIntegerLearnerParam("e"))
#> Type len Def Constr Req Tunable Trafo #> a integervector 2 - 1 to Inf Y TRUE - #> b numeric - -10 -Inf to 0 - TRUE - #> c discrete - - x,y,1 - TRUE - #> d logical - - - - TRUE - #> e integer - - -Inf to Inf - TRUE -