Explore: Uniform Sampling

Suggest edits
Documentation > Explore > Direct Sampling


Uniform Distribution Sampling 🔗

Sampling can also be performed at random within a domain via a UniformDistribution(maximum). This task generates values uniformly distributed between zero and the maximum argument. Custom domains can be defined using transformations, as in the example below that generates values between -10 and + 10.
val my_input = Val[Double]
val my_model = EmptyTask() set( (inputs, outputs) += my_input)

val exploration =
    evaluation = my_model hook ToStringHook(),
    sampling= (my_input in (UniformDistribution[Double](max=20) take 100)).map(x => x -10)


N.B. DirectSampling usage is not limited to uniform or grid sampling, and accepts any type of more advanced sampling.