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

...

(any)
Named parameter values.

.values

(named list())
Named list with parameter values. Names must not already appear in ....

.insert

(logical(1))
Whether to insert the values (old values are being kept, if not overwritten), or to replace all values. Default is TRUE.

### Method subset()

Changes the current set to the set of passed IDs.

#### Usage

ParamSet$search_space(values = self$values)

#### Arguments

values

#### Arguments

xs

(named list()).

#### Returns

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

### Method test()

checkmate-like test-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()).

.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 check_dt()

checkmate-like check-function. Takes a data.table::data.table where rows are points and columns are parameters. 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 be set to NA in xdt.

#### Arguments

id

(character(1)).

on

(character(1)).

cond

(Condition).

### Method format()

Helper for print outputs.

ParamSet$format() ### Method print() Printer. #### Usage ParamSet$print(
...,
hide_cols = c("levels", "is_bounded", "special_vals", "tags", "storage_type")
)

#### Arguments

...

(ignored).

hide_cols

(character())
Which fields should not be printed? Default is "levels", "is_bounded", "special_vals", "tags", and "storage_type".

### Method clone()

The objects of this class are cloneable with this method.

ParamSet$clone(deep = FALSE) #### 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