Learn R Programming

ParamHelpers (version 1.3)

generateGridDesign: Generates a grid design for a parameter set.

Description

The following types of columns are created: ll{ numeric(vector) numeric integer(vector) integer discrete(vector) factor (names of values = levels) logical(vector) logical } If you want to convert these, look at convertDataFrameCols. Dependent parameters whose constraints are unsatisfied generate NA entries in their respective columns.

The algorithm currently performs these steps:

  1. We create a grid. For numerics and integers we use the specfied resolution.
Forbidden points are removed. Parameters are trafoed (maybe); dependent parameters whose constraints are unsatisfied are set to NA entries. Duplicated points are removed. Duplicated points are not generated in a grid design, but the way parameter dependencies are handled make this possible.

Usage

generateGridDesign(par.set, resolution, trafo = FALSE)

Arguments

par.set
[ParamSet] Parameter set.
resolution
[integer] Resolution of the grid for each numeric/integer parameter in par.set. For vector parameters, it is the resolution per dimension. Either pass one resolution for all parameters, or a named vector.
trafo
[logical(1)] Transform all parameters by using theirs respective transformation functions. Default is FALSE.

Value

  • [data.frame]. Columns are named by the ids of the parameters. If the par.set argument contains a vector parameter, its corresponding column names in the design are the parameter id concatenated with 1 to dimension of the vector. The result will have an logical(1) attribute trafo, which is set to the value of argument trafo.

Examples

Run this code
ps = makeParamSet(
  makeNumericParam("x1", lower = -2, upper = 1),
  makeNumericParam("x2", lower = -2, upper = 2, trafo = function(x) x^2)
)
generateGridDesign(ps, resolution = c(x1 = 4, x2 = 5), trafo = TRUE)

Run the code above in your browser using DataLab