File: Param.Rd

package info (click to toggle)
r-cran-paramhelpers 1.14.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 992 kB
  • sloc: ansic: 102; sh: 13; makefile: 2
file content (237 lines) | stat: -rw-r--r-- 7,169 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/aParam.R, R/makeParamFuns.R
\name{Param}
\alias{Param}
\alias{makeNumericParam}
\alias{makeNumericVectorParam}
\alias{makeIntegerParam}
\alias{makeIntegerVectorParam}
\alias{makeLogicalParam}
\alias{makeLogicalVectorParam}
\alias{makeDiscreteParam}
\alias{makeDiscreteVectorParam}
\alias{makeFunctionParam}
\alias{makeUntypedParam}
\alias{makeCharacterParam}
\alias{makeCharacterVectorParam}
\title{Create a description object for a parameter.}
\usage{
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,
  trafo = NULL,
  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()
)
}
\arguments{
\item{id}{(\code{character(1)})\cr
Name of parameter.}

\item{lower}{(\code{numeric} | \code{expression})\cr
Lower bounds. A singe value of
length 1 is automatically replicated to \code{len} for vector parameters. If
\code{len = NA} you can only pass length-1 scalars. Default is \code{-Inf}.}

\item{upper}{(\code{numeric} | \code{expression})\cr
Upper bounds. A singe value of
length 1 is automatically replicated to \code{len} for vector parameters. If
\code{len = NA} you can only pass length-1 scalars. Default is \code{Inf}.}

\item{allow.inf}{(\code{logical(1)})\cr
Allow infinite values for numeric and
numericvector params to be feasible settings. Default is \code{FALSE}.}

\item{default}{(any concrete value | \code{expression})\cr
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.}

\item{trafo}{(\code{NULL} | \verb{function(x)})\cr
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 \code{NULL} which
means no transformation.}

\item{requires}{(\code{NULL} | \code{call} | \code{expression})\cr
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 \code{expression} or \code{quote}, the former type is
auto-converted into the later. Only really useful if the parameter is
included in a (ParamSet()). Default is \code{NULL} which means no requirements.}

\item{tunable}{(\code{logical(1)})\cr
Is this parameter tunable? Defining a
parameter to be not-tunable allows to mark arguments like, e.g.,
\dQuote{verbose} or other purely technical stuff. Note that this flag is
most likely not respected by optimizing procedures unless stated otherwise.
Default is \code{TRUE} (except for \code{untyped}, \code{function}, \code{character} and
\code{characterVector}) which means it is tunable.}

\item{special.vals}{(\code{list()})\cr
A list of special values the parameter can
except which are outside of the defined range. Default is an empty list.}

\item{len}{(\code{integer(1)} | \code{expression})\cr
Length of vector parameter.}

\item{cnames}{(\code{character})\cr
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 \code{cnames}.}

\item{values}{(\code{vector} | \code{list} | \code{expression})\cr
Possible discrete values.
Instead of using a vector of atomic values, you are also allowed to pass a
list of quite \dQuote{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{
[\code{\link[=Param]{Param()}}].
}
\description{
For each parameter type a special constructor function is
available, see below.

For the following arguments you can also pass an \code{expression} instead of a
concrete value: \code{default}, \code{len}, \code{lower}, \code{upper}, \code{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
\code{\link[=evaluateParamExpressions]{evaluateParamExpressions()}}. So this enables data / context dependent
settings, which is sometimes useful.

The S3 class is a list which stores these elements:
\describe{
\item{id (\code{character(1)})}{See argument of same name.}
\item{type (\code{character(1)})}{Data type of parameter. For all type string see (getTypeStringsAll())}
\item{len (\code{integer(1)} | \code{expression})}{See argument of same name.}
\item{lower (\code{numeric} | \code{expression})}{See argument of same name. Length of this vector is \code{len}.}
\item{upper (\code{numeric} | \code{expression})}{See argument of same name. Length of this vector is \code{len}.}
\item{values (\code{list} | \code{expression})}{Discrete values, always stored as a named list.}
\item{cnames (\code{character}}{See argument of same name.}
\item{allow.inf (\code{logical(1)})}{See argument of same name.}
\item{trafo (\code{NULL} | \verb{function(x)})}{See argument of same name.}
\item{requires (\code{NULL} | \code{expression})}{See argument of same name.}
\item{default (any concrete value | \code{expression})}{See argument of same name.}
\item{has.default (\code{logical(1)})}{Extra flag to really be able to check whether the user passed a default, to avoid troubles with \code{NULL} and \code{NA}.}
\item{tunable (\code{logical(1)})}{See argument of same name.}
\item{special.vals (\code{list})}{See argument of same name.}
}
}
\examples{
makeNumericParam("x", lower = -1, upper = 1)
makeNumericVectorParam("x", len = 2)
makeDiscreteParam("y", values = c("a", "b"))
makeCharacterParam("z")
}