Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sampleValues

Sample n random values from a parameter or a parameter set uniformly.


Description

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.

Usage

sampleValues(par, n, discrete.names = FALSE, trafo = FALSE)

Arguments

par

(Param | ParamSet)
Parameter or parameter set.

n

(integer(1))
Number of values.

discrete.names

(logical(1))
Should names be sampled for discrete parameters or values instead? Default is code FALSE.

trafo

(logical(1))
Transform all parameters by using theirs respective transformation functions. Default is FALSE.

Value

list. For consistency always a list is returned.

Examples

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)

ParamHelpers

Helpers for Parameters in Black-Box Optimization, Tuning and Machine Learning

v1.14
BSD_2_clause + file LICENSE
Authors
Bernd Bischl [aut] (<https://orcid.org/0000-0001-6002-6980>), Michel Lang [aut] (<https://orcid.org/0000-0001-9754-0393>), Jakob Richter [cre, aut] (<https://orcid.org/0000-0003-4481-5554>), Jakob Bossek [aut], Daniel Horn [aut], Karin Schork [ctb], Pascal Kerschke [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.