
Last chance! 50% off unlimited learning
Sale ends in
Sample n random values from a parameter or a parameter set uniformly.
Dependent parameters whose requirements are not satisfied are represented by a scalar NA in the output.
sampleValues(par, n, discrete.names = FALSE, trafo = FALSE)
list
. For consistency always a list is returned.
(Param | ParamSet)
Parameter or parameter set.
(integer(1)
)
Number of values.
(logical(1)
)
Should names be sampled for discrete parameters or values instead?
Default is FALSE
.
(logical(1)
)
Transform all parameters by using theirs respective transformation
functions. Default is FALSE
.
p = makeIntegerParam("x", lower = -10, upper = 10)
sampleValues(p, 4)
p = makeNumericParam("x", lower = -10, upper = 10)
sampleValues(p, 4)
p = makeLogicalParam("x")
sampleValues(p, 4)
ps = makeParamSet(
makeNumericParam("u", lower = 1, upper = 10),
makeIntegerParam("v", lower = 1, upper = 10),
makeDiscreteParam("w", values = 1:2)
)
sampleValues(ps, 2)
Run the code above in your browser using DataLab