Output transformation that performs standardization to zero mean and unit variance.
See also
Other Output Transformation:
OutputTrafo
,
OutputTrafoLog
,
mlr_output_trafos
Super class
mlr3mbo::OutputTrafo
-> OutputTrafoStandardize
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 viarequireNamespace()
.
Methods
Inherited methods
Method new()
Creates a new instance of this R6 class.
Usage
OutputTrafoStandardize$new(invert_posterior = TRUE)
Arguments
invert_posterior
(
logical(1)
)
Should the posterior predictive distribution be inverted when used within a SurrogateLearner or SurrogateLearnerCollection? Default isTRUE
.
Method update()
Learn the transformation based on observed data and update parameters in $state
.
Arguments
ydt
(
data.table::data.table()
)
Data. One row per observation with columns$cols_y
.
Method transform()
Perform the transformation.
Arguments
ydt
(
data.table::data.table()
)
Data. One row per observation with at least columns$cols_y
.
Returns
data.table::data.table()
with the transformation applied to the columns $cols_y
.
Method inverse_transform_posterior()
Perform the inverse transformation on a posterior predictive distribution characterized by the first and second moment.
Arguments
pred
(
data.table::data.table()
)
Data. One row per observation characterizing a posterior predictive distribution with the columnsmean
andse
. Can also be a named list ofdata.table::data.table()
with posterior predictive distributions for multiple targets corresponding to (cols_y
).
Returns
data.table::data.table()
with the inverse transformation applied to the columns mean
and se
.
In the case of the input being a named list of data.table::data.table()
, the output will be a named list of data.table::data.table()
with the inverse transformation applied to the columns mean
and se
.
Method inverse_transform()
Perform the inverse transformation.
Arguments
ydt
(
data.table::data.table()
)
Data. One row per observation with at least columns$cols_y
.
Returns
data.table::data.table()
with the inverse transformation applied to the columns $cols_y
.
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()
output_trafo = ot("standardize", invert_posterior = TRUE)
surrogate = srlrn(learner, output_trafo = output_trafo, archive = instance$archive)
surrogate$update()
surrogate$output_trafo$state
surrogate$predict(data.table(x = c(-1, 0, 1)))
surrogate$output_trafo$invert_posterior = FALSE
surrogate$predict(data.table(x = c(-1, 0, 1)))
}
#> mean se
#> <num> <num>
#> 1: -0.9215786 0.01389580
#> 2: -0.9649938 0.07362557
#> 3: -0.9792974 0.16448148