R: Logging object for objective function evaluations

Archive {bbotk} | R Documentation

## Logging object for objective function evaluations

### Description

Container around a data.table::data.table which stores all performed function calls of the Objective.

### Technical details

The data is stored in a private `.data` field that contains a data.table::data.table which logs all performed function calls of the Objective. This data.table::data.table is accessed with the public `$data()` method. New values can be added with the `$add_evals()` method. This however is usually done through the evaluation of the OptimInstance by the Optimizer.

### Public fields

`search_space`

  (paradox::ParamSet)
  Search space of objective.

`codomain`

  (paradox::ParamSet)
  Codomain of objective function.

`start_time`

  (POSIXct).

`check_values`

  (`logical(1)`)

### Active bindings

`n_evals`

  (`integer(1)`)
  Number of evaluations stored in the archive.

`n_batch`

  (`integer(1)`)
  Number of batches stored in the archive.

`cols_x`

  (`character()`). Column names of search space parameters.

`cols_y`

  (`character()`). Column names of codomain parameters.

### Methods

#### Public methods

- `Archive$new()`

- `Archive$add_evals()`

- `Archive$best()`

- `Archive$data()`

- `Archive$format()`

- `Archive$print()`

- `Archive$clear()`

- `Archive$clone()`

#### Method `new()`

Creates a new instance of this R6 class.

##### Usage

    Archive$new(search_space, codomain, check_values = TRUE)

##### Arguments

`search_space`

  (paradox::ParamSet)
  Specifies the search space for the Optimizer. The paradox::ParamSet describes either a subset of the `domain` of the Objective or it describes a set of parameters together with a `trafo` function that transforms values from the search space to values of the domain. Depending on the context, this value defaults to the domain of the objective.

`codomain`

  (paradox::ParamSet)
  Specifies codomain of function. Most importantly the tags of each output "Parameter" define whether it should be minimized or maximized. The default is to minimize each component.

`check_values`

  (`logical(1)`)
  Should x-values that are added to the archive be checked for validity? Search space that is logged into archive.

#### Method `add_evals()`

Adds function evaluations to the archive table.

##### Usage

    Archive$add_evals(xdt, xss_trafoed, ydt)

##### Arguments

`xdt`

  (`data.table::data.table()`)
  Set of untransformed points / points from the search space. One point per row, e.g. `data.table(x1 = c(1, 3), x2 = c(2, 4))`. Column names have to match ids of the `search_space`. However, `xdt` can contain additional columns.

`xss_trafoed`

  (`list()`)
  Transformed point(s) in the domain space.

`ydt`

  (`data.table::data.table()`)
  Optimal outcome.

#### Method `best()`

Returns the best scoring evaluation. For single-crit optimization, the solution that minimizes / maximizes the objective function. For multi-crit optimization, the Pareto set / front.

##### Usage

    Archive$best(m = NULL)

##### Arguments

`m`

  (`integer()`)
  Take only batches `m` into account. Default is all batches.

##### Returns

`data.table::data.table()`.

#### Method `data()`

Returns a data.table::data.table which contains all performed Objective function calls.

##### Usage

    Archive$data(unnest = NULL)

##### Arguments

`unnest`

  (`character()`)
  Set of column names for columns to unnest via `mlr3misc::unnest()`. Unnested columns are stored in separate columns instead of list-columns.

##### Returns

`data.table::data.table()`.

#### Method `format()`

Helper for print outputs.

##### Usage

    Archive$format()

#### Method `print()`

Printer.

##### Usage

    Archive$print()

##### Arguments

`...`

  (ignored).

#### Method `clear()`

Clear all evaluation results from archive.

##### Usage

    Archive$clear()

#### Method `clone()`

The objects of this class are cloneable with this method.

##### Usage

    Archive$clone(deep = FALSE)

##### Arguments

`deep`

  Whether to make a deep clone.

[Package bbotk version 0.2.2 Index]