Output transformation that takes the logarithm after min-max scaling to \(0, 1\).
See also
Other Output Transformation:
OutputTrafo,
OutputTrafoStandardize,
mlr_output_trafos
Super class
mlr3mbo::OutputTrafo -> OutputTrafoLog
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
OutputTrafoLog$new(invert_posterior = FALSE)Arguments
invert_posterior(
logical(1))
Should the posterior predictive distribution be inverted when used within a SurrogateLearner or SurrogateLearnerCollection? Default isFALSE.
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 columnsmeanandse. 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("log", 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: -4.202650 1.262598
#> 2: -6.648200 0.848639
#> 3: -5.527866 1.879272