Skip to contents

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

See also

Other Input Transformation: InputTrafo, mlr_input_trafos

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

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage


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.

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)))
}
#>         mean        se
#>        <num>     <num>
#> 1: 3.9850673 4.2925690
#> 2: 1.9068454 3.0487653
#> 3: 0.8955834 0.4707067