Learn R Programming

ParamHelpers (version 1.8)

LearnerParam: Create a description object for a parameter of a machine learning algorithm.

Description

This specializes Param by adding a few more attributes, like a default value, whether it refers to a training or a predict function, etc.

Usage

makeNumericLearnerParam(id, lower = -Inf, upper = Inf, allow.inf = FALSE, default, when = "train", requires = NULL, tunable = TRUE)
makeNumericVectorLearnerParam(id, len = as.integer(NA), lower = -Inf, upper = Inf, allow.inf = FALSE, default, when = "train", requires = NULL, tunable = TRUE)
makeIntegerLearnerParam(id, lower = -Inf, upper = Inf, default, when = "train", requires = NULL, tunable = TRUE)
makeIntegerVectorLearnerParam(id, len = as.integer(NA), lower = -Inf, upper = Inf, default, when = "train", requires = NULL, tunable = TRUE)
makeDiscreteLearnerParam(id, values, default, when = "train", requires = NULL, tunable = TRUE)
makeDiscreteVectorLearnerParam(id, len = as.integer(NA), values, default, when = "train", requires = NULL, tunable = TRUE)
makeLogicalLearnerParam(id, default, when = "train", requires = NULL, tunable = TRUE)
makeLogicalVectorLearnerParam(id, len = as.integer(NA), default, when = "train", requires = NULL, tunable = TRUE)
makeUntypedLearnerParam(id, default, when = "train", requires = NULL, tunable = TRUE)
makeFunctionLearnerParam(id, default, when = "train", requires = NULL)

Arguments

id
[character(1)] Name of parameter.
lower
[numeric] Lower bounds. A singe value of length 1 is automatically replicated to len for vector parameters. Default is -Inf.
upper
[numeric] Upper bounds. A singe value of length 1 is automatically replicated to len for vector parameters. Default is Inf.
allow.inf
[logical(1)] Allow infinite values for numeric and numericvector params to be feasible settings. Default is FALSE.
default
[any] Default value used in learner. If this argument is missing, it means no default value is available.
when
[character(1)] Specifies when parameter is used in the learner: “train”, “predict” or “both”. Default is “train”.
requires
[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. Note that if your dependent parameter is a logical Boolean you need to verbosely write requires = quote(a == TRUE) and not requires = quote(a). Default is NULL which means no requirements.
tunable
[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, and allows them to be excluded from later automatic optimization procedures that would try to consider all available parameters. Default is TRUE (except for untyped, function, character and characterVector) which means it is tunable.
len
[integer(1)] Length of vector parameter.
values
[vector | list] 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.

Value

[LearnerParam].

Details

The S3 class is a Param which additionally stores these elements:
default [any]
See argument of same name.

has.default [logical(1)]
Was a default value provided?

when [character(1)]
See argument of same name.