Skip to contents

Generate a space-filling design using Latin hypercube sampling. Dependent parameters whose constraints are unsatisfied generate NA entries in their respective columns.

Usage

generate_design_lhs(param_set, n, lhs_fun = NULL)

Arguments

param_set

(ParamSet).

n

(integer(1))
Number of points to sample.

lhs_fun

(function(n, k))
Function to use to generate a LHS sample, with n samples and k values per param. LHS functions are implemented in package lhs, default is to use lhs::maximinLHS().

Value

Design.

See also

Examples

ps = ParamSet$new(list(
  ParamDbl$new("ratio", lower = 0, upper = 1),
  ParamFct$new("letters", levels = letters[1:3])
))

if (requireNamespace("lhs", quietly = TRUE)) {
  generate_design_lhs(ps, 10)
}
#> <Design> with 10 rows:
#>          ratio letters
#>  1: 0.66533919       b
#>  2: 0.27392232       a
#>  3: 0.14258763       a
#>  4: 0.84350202       c
#>  5: 0.71083953       b
#>  6: 0.33858173       b
#>  7: 0.09192026       c
#>  8: 0.95015803       a
#>  9: 0.45525933       a
#> 10: 0.55060737       c