ParamDbl: Numerical Parameter

ParamDblR Documentation

Numerical Parameter

Description

A Param to describe real-valued parameters.

Super class

paradox::Param -> ParamDbl

Public fields

lower

(numeric(1))
Lower bound. Always NA for ParamFct, ParamLgl and ParamUty.

upper

(numeric(1))
Upper bound. Always NA for ParamFct, ParamLgl and ParamUty.

tolerance

(numeric(1))
tolerance of values to accept beyond ⁠$lower⁠ and ⁠$upper⁠. Used both for relative and absolute tolerance.

Active bindings

levels

(character() | NULL)
Set of allowed levels. Always NULL for ParamDbl, ParamInt and ParamUty. Always c(TRUE, FALSE) for ParamLgl.

nlevels

(integer(1) | Inf)
Number of categorical levels. Always Inf for ParamDbl and ParamUty. The number of integers in the range ⁠[lower, upper]⁠, or Inf if unbounded for ParamInt. Always 2 for ParamLgl.

is_bounded

(logical(1))
Are the bounds finite? Always TRUE for ParamFct and ParamLgl. Always FALSE for ParamUty.

storage_type

(character(1))
Data type when values of this parameter are stored in a data table or sampled. Always "numeric" for ParamDbl. Always "character" for ParamFct. Always "integer" for ParamInt. Always "logical" for ParamLgl. Always "list" for ParamUty.

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
ParamDbl$new(
  id,
  lower = -Inf,
  upper = Inf,
  special_vals = list(),
  default = NO_DEF,
  tags = character(),
  tolerance = sqrt(.Machine$double.eps)
)
Arguments
id

(character(1))
Identifier of the object.

lower

(numeric(1))
Lower bound, can be -Inf.

upper

(numeric(1))
Upper bound can be +Inf.

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. The value has no effect on ParamSet$values or the behavior of ParamSet$check(), ⁠$test()⁠ or ⁠$assert()⁠. The default is intended to be used for documentation purposes. '

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.

tolerance

(numeric(1))
Initializes the ⁠$tolerance⁠ field that determines the


Method convert()

Restrict the value to within the allowed range. This works in conjunction with ⁠$tolerance⁠, which accepts values slightly out of this range.

Usage
ParamDbl$convert(x)
Arguments
x

(numeric(1))
Value to convert.


Method clone()

The objects of this class are cloneable with this method.

Usage
ParamDbl$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Note

The upper and lower bounds in ⁠$check()⁠ are expanded by sqrt(.Machine$double.eps) to prevent errors due to the precision of double values.

See Also

Other Params: ParamFct, ParamInt, ParamLgl, ParamUty, Param

Examples

ParamDbl$new("ratio", lower = 0, upper = 1, default = 0.5)

paradox documentation built on April 1, 2023, 12:15 a.m.