pSS, short for “ParamSet Sugar”, is a shorthand API for
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
This makes definition of
ParamSets shorter and more readable.
The difference between
pSSLrn is only in the default value of
FALSE for the former and
TRUE for the latter.
1 2 3
Parameters, see Details below.
The arguments are of the form
name = default: type range [^ dimension] [settings].
name is any valid R identifier name.
= default Determines the 'default' setting
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
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
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 evaluating to a list,
or of the form
[value1, value2, ...], creating a discrete parameter of character
or numeric values according to
value2 etc. If
type is one of “integer” or “numeric”,
range is of the form
[lowBound, upBound], where
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
or use tilde-dot (“~.”).
^ dimension is optionally determining the dimension of a ‘vector’ parameter.
If it is absent, the result is a normal
LearnerParam, if it is present,
the result is a
Vector(Learner)Param. Note that a one-dimensional
is distinct from a normal
codesettings may be a collection of further settings to supply to
and is optional. To specify one or more settings, put in double square brackets (
and comma-separate settings if more than one is present.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
pSSLrn(a = NA: integer [~0, ]^2 [[requires = expression(b != 0)]], b = -10: numeric [~., 0], c: discrete [x, y, 1], d: logical, e: integer) # 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.