mlr_acqfunctions_multi: Acquisition Function Wrapping Multiple Acquisition Functions

mlr_acqfunctions_multiR Documentation

Acquisition Function Wrapping Multiple Acquisition Functions

Description

Wrapping multiple AcqFunctions resulting in a multi-objective acquisition function composed of the individual ones. Note that the optimization direction of each wrapped acquisition function is corrected for maximization.

For each acquisition function, the same Surrogate must be used. If acquisition functions passed during construction already have been initialized with a surrogate, it is checked whether the surrogate is the same for all acquisition functions. If acquisition functions have not been initialized with a surrogate, the surrogate passed during construction or lazy initialization will be used for all acquisition functions.

For optimization, AcqOptimizer can be used as for any other AcqFunction, however, the bbotk::Optimizer wrapped within the AcqOptimizer must support multi-objective optimization as indicated via the multi-crit property.

Dictionary

This AcqFunction can be instantiated via the dictionary mlr_acqfunctions or with the associated sugar function acqf():

mlr_acqfunctions$get("multi")
acqf("multi")

Super classes

bbotk::Objective -> mlr3mbo::AcqFunction -> AcqFunctionMulti

Active bindings

surrogate

(Surrogate)
Surrogate.

acq_functions

(list of AcqFunction)
Points to the list of the individual acquisition functions.

acq_function_ids

(character())
Points to the ids of the individual acquisition functions.

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
AcqFunctionMulti$new(acq_functions, surrogate = NULL)
Arguments
acq_functions

(list of AcqFunctions).

surrogate

(NULL | Surrogate).


Method update()

Update each of the wrapped acquisition functions.

Usage
AcqFunctionMulti$update()

Method clone()

The objects of this class are cloneable with this method.

Usage
AcqFunctionMulti$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other Acquisition Function: AcqFunction, mlr_acqfunctions, mlr_acqfunctions_aei, mlr_acqfunctions_cb, mlr_acqfunctions_ehvi, mlr_acqfunctions_ehvigh, mlr_acqfunctions_ei, mlr_acqfunctions_eips, mlr_acqfunctions_mean, mlr_acqfunctions_pi, mlr_acqfunctions_sd, mlr_acqfunctions_smsego

Examples

if (requireNamespace("mlr3learners") &
    requireNamespace("DiceKriging") &
    requireNamespace("rgenoud")) {
  library(bbotk)
  library(paradox)
  library(mlr3learners)
  library(data.table)

  fun = function(xs) {
    list(y = xs$x ^ 2)
  }
  domain = ps(x = p_dbl(lower = -10, upper = 10))
  codomain = ps(y = p_dbl(tags = "minimize"))
  objective = ObjectiveRFun$new(fun = fun, domain = domain, codomain = codomain)

  instance = OptimInstanceBatchSingleCrit$new(
    objective = objective,
    terminator = trm("evals", n_evals = 5))

  instance$eval_batch(data.table(x = c(-6, -5, 3, 9)))

  learner = default_gp()

  surrogate = srlrn(learner, archive = instance$archive)

  acq_function = acqf("multi",
    acq_functions = acqfs(c("ei", "pi", "cb")),
    surrogate = surrogate
  )

  acq_function$surrogate$update()
  acq_function$update()
  acq_function$eval_dt(data.table(x = c(-1, 0, 1)))
}

mlr3mbo documentation built on Oct. 17, 2024, 1:06 a.m.