A set of Param objects. Please note that when creating a set or adding to it, the parameters of the resulting set have to be uniquely named with IDs with valid R names. The set also contains a member variable values which can be used to store an active configuration / or to partially fix some parameters to constant values (regarding subsequent sampling or generation of designs).

## S3 methods and type converters

• as.data.table()
ParamSet -> data.table::data.table()
Compact representation as datatable. Col types are:

• id: character

• lower, upper: double

• levels: list col, with NULL elements

• special_vals: list col of list

• is_bounded: logical

• default: list col, with NULL elements

• storage_type: character

• tags: list col of character vectors

## Public fields

assert_values

(logical(1))
Should values be checked for validity during assigment to active binding $values? Default is TRUE, only switch this off if you know what you are doing. ## Active bindings params (named list()) List of Param, named with their respective ID. params_unid (named list()) List of Param, named with their true ID. However, this field has the Param's $id value set to a potentially invalid value. This active binding should only be used internally.

deps

(data.table::data.table())
Table has cols id (character(1)) and on (character(1)) and cond (Condition). Lists all (direct) dependency parents of a param, through parameter IDs. Internally created by a call to add_dep. Settable, if you want to remove dependencies or perform other changes.

set_id

(character(1))
ID of this param set. Default "". Settable.

length

(integer(1))
Number of contained Params.

is_empty

(logical(1))
Is the ParamSet empty?

class

(named character())
Classes of contained parameters, named with parameter IDs.

lower

(named double())
Lower bounds of parameters (NA if parameter is not numeric). Named with parameter IDs.

upper

(named double())
Upper bounds of parameters (NA if parameter is not numeric). Named with parameter IDs.

levels

(named list())
List of character vectors of allowed categorical values of contained parameters. NULL if the parameter is not categorical. Named with parameter IDs.

nlevels

(named integer())
Number of categorical levels per parameter, Inf for double parameters or unbounded integer parameters. Named with param IDs.

is_bounded

(named logical())
Do all parameters have finite bounds? Named with parameter IDs.

special_vals

(named list() of list())
Special values for all parameters. Named with parameter IDs.

default

(named list())
Default values of all parameters. If no default exists, element is not present. Named with parameter IDs.

tags

(named list() of character())
Can be used to group and subset parameters. Named with parameter IDs.

storage_type

(character())
Data types of parameters when stored in tables. Named with parameter IDs.

is_number

(named logical())
Position is TRUE for ParamDbl and ParamInt. Named with parameter IDs.

is_categ

(named logical())
Position is TRUE for ParamFct and ParamLgl. Named with parameter IDs.

all_numeric

(logical(1))
Is TRUE if all parameters are ParamDbl or ParamInt.

all_categorical

(logical(1))
Is TRUE if all parameters are ParamFct and ParamLgl.

trafo

(function(x, param_set))
Transformation function. Settable. User has to pass a function(x, param_set), of the form
(named list(), ParamSet) -> named list().
The function is responsible to transform a feasible configuration into another encoding, before potentially evaluating the configuration with the target algorithm. For the output, not many things have to hold. It needs to have unique names, and the target algorithm has to accept the configuration. For convenience, the self-paramset is also passed in, if you need some info from it (e.g. tags). Is NULL by default, and you can set it to NULL to switch the transformation off.

has_trafo

(logical(1))
Has the set a trafo function?

values

(named list())
Currently set / fixed parameter values. Settable, and feasibility of values will be checked when you set them. You do not have to set values for all parameters, but only for a subset. When you set values, all previously set values will be unset / removed.

has_deps

(logical(1))
Has the set parameter dependencies?

## Methods

### Method new()

Creates a new instance of this R6 class.

#### Arguments

p

(Param | ParamSet).

### Method ids()

Retrieves IDs of contained parameters based on some filter criteria selections, NULL means no restriction. Only returns IDs of parameters that satisfy all conditions.

#### Arguments

ids

(character()).

### Method check()

checkmate-like check-function. Takes a named list. A point x is feasible, if it configures a subset of params, all individual param constraints are satisfied and all dependencies are satisfied. Params for which dependencies are not satisfied should not be part of x.

#### Arguments

xs

(named list()).

#### Returns

If successful TRUE, if not FALSE.

### Method assert()

checkmate-like assert-function. Takes a named list. A point x is feasible, if it configures a subset of params, all individual param constraints are satisfied and all dependencies are satisfied. Params for which dependencies are not satisfied should not be part of x.

#### Arguments

xdt

(data.table::data.table | data.frame()).

#### Returns

If successful TRUE, if not a string with the error message.

### Method test_dt()

#### Arguments

xdt

#### Returns

If successful TRUE, if not FALSE.

### Method assert_dt()

#### Arguments

xdt
.var.name

(character(1))
Name of the checked object to print in error messages.
Defaults to the heuristic implemented in vname.

#### Returns

If successful xs invisibly, if not an error message.

### Method add_dep()

Adds a dependency to this set, so that param id now depends on param on.

### Method print()

Printer.

#### Arguments

deep

Whether to make a deep clone.

## Examples

ps = ParamSet$new( params = list( ParamDbl$new("d", lower = -5, upper = 5, default = 0),
ParamFct$new("f", levels = letters[1:3]) ) ) ps$trafo = function(x, param_set) {
x$d = 2^x$d
return(x)
}

ps$add(ParamInt$new("i", lower = 0L, upper = 16L))

ps\$check(list(d = 2.1, f = "a", i = 3L))
#> [1] TRUE