ObjectiveRFunDt {bbotk}R Documentation

Objective interface for basic R functions.

Description

Objective interface where user can pass an R function that works on an data.table().

Super class

bbotk::Objective -> ObjectiveRFunDt

Active bindings

fun

(function)
Objective function.

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
ObjectiveRFunDt$new(
  fun,
  domain,
  codomain = NULL,
  id = "function",
  properties = character(),
  constants = ps(),
  check_values = TRUE
)
Arguments
fun

(function)
R function that encodes objective and expects an data.table() as input whereas each point is represented by one row.

domain

(paradox::ParamSet)
Specifies domain of function. The paradox::ParamSet should describe all possible input parameters of the objective function. This includes their id, their types and the possible range.

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.

id

(character(1)).

properties

(character()).

constants

(paradox::ParamSet)
Changeable constants or parameters that are not subject to tuning can be stored and accessed here.

check_values

(logical(1))
Should points before the evaluation and the results be checked for validity?


Method eval_many()

Evaluates multiple input values received as a list, converted to a data.table() on the objective function. Missing columns in xss are filled with NAs in xdt.

Usage
ObjectiveRFunDt$eval_many(xss)
Arguments
xss

(list())
A list of lists that contains multiple x values, e.g. list(list(x1 = 1, x2 = 2), list(x1 = 3, x2 = 4)).

Returns

data.table::data.table() that contains one y-column for single-criteria functions and multiple y-columns for multi-criteria functions, e.g. data.table(y = 1:2) or data.table(y1 = 1:2, y2 = 3:4).


Method eval_dt()

Evaluates multiple input values on the objective function supplied by the user.

Usage
ObjectiveRFunDt$eval_dt(xdt)
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.

Returns

data.table::data.table()] that contains one y-column for single-criteria functions and multiple y-columns for multi-criteria functions, e.g. data.table(y = 1:2) or data.table(y1 = 1:2, y2 = 3:4).


Method clone()

The objects of this class are cloneable with this method.

Usage
ObjectiveRFunDt$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


[Package bbotk version 0.8.0 Index]