R/sample.R
sampleValues.Rd
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)
par | |
---|---|
n | ( |
discrete.names | ( |
trafo | ( |
list
. For consistency always a list is returned.
#> [[1]] #> [1] 4 #> #> [[2]] #> [1] -9 #> #> [[3]] #> [1] 10 #> #> [[4]] #> [1] -7 #>#> [[1]] #> [1] 0.3711327 #> #> [[2]] #> [1] 6.922401 #> #> [[3]] #> [1] 4.365394 #> #> [[4]] #> [1] -5.17372 #>#> [[1]] #> [1] FALSE #> #> [[2]] #> [1] FALSE #> #> [[3]] #> [1] TRUE #> #> [[4]] #> [1] FALSE #>ps = makeParamSet( makeNumericParam("u", lower = 1, upper = 10), makeIntegerParam("v", lower = 1, upper = 10), makeDiscreteParam("w", values = 1:2) ) sampleValues(ps, 2)#> [[1]] #> [[1]]$u #> [1] 8.25112 #> #> [[1]]$v #> [1] 9 #> #> [[1]]$w #> [1] 1 #> #> #> [[2]] #> [[2]]$u #> [1] 2.965879 #> #> [[2]]$v #> [1] 5 #> #> [[2]]$w #> [1] 2 #> #>