Abstract base class for parameters.

Format

R6::R6Class object.

Construction

Param$new(id, special_vals, default, tags)
  • id :: character(1)
    ID of this parameter.

  • special_vals :: list()
    Arbitrary special values this parameter is allowed to take, to make it feasible. This allows extending the domain of the parameter. Note that these values are only used in feasibility checks, neither in generating designs nor sampling.

  • default :: any
    Default value. Can be from the domain of the parameter or an element of special_vals. Has value NO_DEF if no default exists. NULL can be a valid default.

  • tags :: character()
    Arbitrary tags to group and subset parameters. Some tags serve a special purpose:

    • "required" implies that the parameters has to be given when setting values in ParamSet.

Fields

  • class :: character(1)
    R6 class name. Read-only.

  • is_number :: logical(1)
    TRUE if the parameter is of type "dbl" or "int".

  • is_categ :: logical(1)
    TRUE if the parameter is of type "fct" or "lgl".

  • has_default :: logical(1)
    Is there a default value?

  • storage_type :: character(1)
    Data type when values of this parameter are stored in a data table or sampled.

Methods

  • test(x), check(x), assert(x)
    Three checkmate-like check-functions. Take a value from the domain of the parameter, and check if it is feasible. A value is feasible if it is of the same storage_type, inside of the bounds or element of special_vals.

  • qunif(x)
    numeric(n) -> vector(n)
    Takes values from [0,1] and map them, regularly distributed, to the domain of the parameter. Think of: quantile function or the use case to map a uniform-[0,1] random variable into a uniform sample from this param.

  • rep(n)
    integer(1) -> ParamSet
    Repeats this parameter n-times (by cloning). Each parameter is named "[id]rep[k]" and gets the additional tag "[id]_rep".

S3 methods

See also