param_random | R Documentation |
This function returns a 0 argument function that can be used as
a generator function in the random.params
argument of the
param.net
function.
param_random(values, prob = NULL)
values |
A vector of values to sample from. |
prob |
A vector of weights to use during sampling. If |
A 0 argument generator function to sample one of the values from the
values
vector.
param.net
and generate_random_params
# Define function with equal sampling probability
a <- param_random(1:5)
a()
# Define function with unequal sampling probability
b <- param_random(1:5, prob = c(0.1, 0.1, 0.1, 0.1, 0.6))
b()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.