File: generateGridDesign.Rd

package info (click to toggle)
r-cran-paramhelpers 1.14.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 992 kB
  • sloc: ansic: 102; sh: 13; makefile: 2
file content (69 lines) | stat: -rw-r--r-- 3,071 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/generateGridDesign.R
\name{generateGridDesign}
\alias{generateGridDesign}
\title{Generates a grid design for a parameter set.}
\usage{
generateGridDesign(par.set, resolution, trafo = FALSE)
}
\arguments{
\item{par.set}{\link{ParamSet}\cr
Parameter set.}

\item{resolution}{(\code{integer})\cr
Resolution of the grid for each numeric/integer parameter in \code{par.set}.
For vector parameters, it is the resolution per dimension.
Either pass one resolution for all parameters, or a named vector.}

\item{trafo}{(\code{logical(1)})\cr
Transform all parameters by using theirs respective transformation
functions. Default is \code{FALSE}.}
}
\value{
\link{data.frame}. Columns are named by the ids of the parameters. If the
\code{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 \code{logical(1)} attribute
\dQuote{trafo}, which is set to the value of argument \code{trafo}.
}
\description{
The following types of columns are created:
\tabular{ll}{
numeric(vector)   \tab  \code{numeric}  \cr
integer(vector)   \tab  \code{integer}  \cr
discrete(vector)  \tab  \code{factor} (names of values = levels) \cr
logical(vector)   \tab  \code{logical}
}
If you want to convert these, look at \code{\link[BBmisc:convertDataFrameCols]{BBmisc::convertDataFrameCols()}}.
Dependent parameters whose constraints are unsatisfied generate \code{NA} entries
in their respective columns. For discrete vectors the levels and their order
will be preserved.

The algorithm currently performs these steps:
\enumerate{
\item{We create a grid. For numerics and integers we use the specified resolution. For discretes all values will be taken.}
\item{Forbidden points are removed.}
\item{Parameters are trafoed (potentially, depending on the setting of argument \code{trafo});
dependent parameters whose constraints are unsatisfied are set to \code{NA} entries.}
\item{Duplicated points are removed. Duplicated points are not generated in a
grid design, but the way parameter dependencies are handled make this possible.}
}

Note that if you have trafos attached to your params, the complete creation
of the design (except for the detection of invalid parameters w.r.t to their
\code{requires} setting) takes place on the UNTRANSFORMED scale. So this function
creates a regular grid over the param space on the UNTRANSFORMED scale, but
not necessarily the transformed scale.

\code{generateDesign} will NOT work if there are dependencies over multiple levels
of parameters and the dependency is only given with respect to the
\dQuote{previous} parameter. A current workaround is to state all
dependencies on all parameters involved. (We are working on it.)
}
\examples{
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)
}