Package website: release | dev
Universal Parameter Space Description and Tools.
set.seed(123) knitr::opts_chunk$set(cache = FALSE, collapse = TRUE, comment = "#>") options(datatable.print.class = FALSE, datatable.print.keys = FALSE) library(paradox)
remotes::install_github("mlr-org/paradox")
Create a simple ParamSet using all supported Parameter Types:
"int"
)"dbl"
)TRUE
or FALSE
("lgl"
)"fct"
)pset = ps( z = p_int(lower = 1, upper = 3), x = p_dbl(lower = -10, upper = 10), flag = p_lgl(), methods = p_fct(c("a","b","c")) )
Draw random samples / create random design:
generate_design_random(pset, 3)
Generate LHS Design:
requireNamespace("lhs") generate_design_lhs(pset, 3)
Generate Grid Design:
generate_design_grid(pset, resolution = 2)
Properties of the parameters within the ParamSet
:
pset$ids() pset$levels pset$nlevels pset$is_number pset$lower pset$upper
Check that a parameter satisfies all conditions of a ParamSet
, using $test()
(returns FALSE
on mismatch), $check()
(returns error description on mismatch), and $assert()
(throws error on mismatch):
pset$test(list(z = 1, x = 1)) pset$test(list(z = -1, x = 1)) pset$check(list(z = -1, x = 1)) pset$assert(list(z = -1, x = 1))
Transformations are functions with a fixed signature.
x
A named list of parameter valuesparam_set
the ParamSet
used to create the designTransformations can be used to change the distributions of sampled parameters.
For example, to sample values between $2^-3$ and $2^3$ in a $log_2$-uniform distribution, one can sample uniformly between -3 and 3 and exponentiate the random value inside the transformation.
Alternatively, logscale = TRUE
can be set; in this case, lower
and upper
represent the values after the transformation.
pset = ps( z = p_int(lower = -3, upper = 3), x = p_dbl(lower = 2^-3, upper = 2^3, logscale = TRUE) ) pset$extra_trafo = function(x, param_set) { x$z = 2^x$z return(x) } pset_smplr = SamplerUnif$new(pset) x = pset_smplr$sample(2) xst = x$transpose() xst
Further documentation can be found in the in-depth tutorial
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.