InputTrafoUnitcube: Input Transformation Unitcube

InputTrafoUnitcubeR Documentation

Input Transformation Unitcube

Description

Input transformation that performs for each numeric and integer feature min-max scaling to ⁠[\0, 1\]⁠ based on the boundaries of the search space.

[\0, 1]: R:%5C%5C0,%201%5C

Super class

mlr3mbo::InputTrafo -> InputTrafoUnitcube

Active bindings

packages

(character())
Set of required packages. A warning is signaled if at least one of the packages is not installed, but loaded (not attached) later on-demand via requireNamespace().

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage
InputTrafoUnitcube$new()

Method update()

Learn the transformation based on observed data and update parameters in ⁠$state⁠.

Usage
InputTrafoUnitcube$update(xdt)
Arguments
xdt

(data.table::data.table())
Data. One row per observation with at least columns ⁠$cols_x⁠.


Method transform()

Perform the transformation.

Usage
InputTrafoUnitcube$transform(xdt)
Arguments
xdt

(data.table::data.table())
Data. One row per observation with at least columns ⁠$cols_x⁠.

Returns

data.table::data.table() with the transformation applied to the columns ⁠$cols_x⁠ (if applicable) or a subset thereof.


Method clone()

The objects of this class are cloneable with this method.

Usage
InputTrafoUnitcube$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other Input Transformation: InputTrafo, mlr_input_trafos

Examples

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

  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))

  xdt = generate_design_random(instance$search_space, n = 4)$data

  instance$eval_batch(xdt)

  learner = default_gp()

  input_trafo = it("unitcube")

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

  surrogate$update()

  surrogate$input_trafo$state

  surrogate$predict(data.table(x = c(-1, 0, 1)))
}

mlr3mbo documentation built on June 8, 2025, 12:24 p.m.