initSelector | R Documentation |
Sample the vector.name
variable such that the number of ones
has a given distribution.
initSelector( individuals, vector.name = "selector.selection", distribution = function() floor(runif(1, 0, length(individuals[[1]][[vector.name]]) + 1)), soften.op = NULL, soften.op.strategy = NULL, soften.op.repeat = 1, reject.condition = function(x) !any(x) )
individuals |
|
vector.name |
|
distribution |
|
soften.op |
|
soften.op.strategy |
|
soften.op.repeat |
|
reject.condition |
|
list of named lists
the individuals with initialized
[[vector.name]]
.
library(mlrCPO) # Initialize parameter set and sample candidates ps <- pSS( maxdepth: integer[1, 30], minsplit: integer[2, 30], cp: numeric[0.001, 0.999], selector.selection: logical^5) initials <- sampleValues(ps, 15, discrete.names = TRUE) # Resample logical vector selector.selection of initials # with binomial distribution initSelector(initials, distribution = function() rbinom(n = 5, size = 5, prob = 0.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.