OutputTrafoLog | R Documentation |
Output transformation that takes the logarithm after min-max scaling to \(0, 1\)
.
mlr3mbo::OutputTrafo
-> OutputTrafoLog
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()
.
new()
Creates a new instance of this R6 class.
OutputTrafoLog$new(invert_posterior = FALSE)
invert_posterior
(logical(1)
)
Should the posterior predictive distribution be inverted when used within a SurrogateLearner or SurrogateLearnerCollection?
Default is FALSE
.
update()
Learn the transformation based on observed data and update parameters in $state
.
OutputTrafoLog$update(ydt)
ydt
(data.table::data.table()
)
Data. One row per observation with columns $cols_y
.
transform()
Perform the transformation.
OutputTrafoLog$transform(ydt)
ydt
(data.table::data.table()
)
Data. One row per observation with at least columns $cols_y
.
data.table::data.table()
with the transformation applied to the columns $cols_y
.
inverse_transform_posterior()
Perform the inverse transformation on a posterior predictive distribution characterized by the first and second moment.
OutputTrafoLog$inverse_transform_posterior(pred)
pred
(data.table::data.table()
)
Data. One row per observation characterizing a posterior predictive distribution with the columns mean
and se
.
Can also be a named list of data.table::data.table()
with posterior predictive distributions for multiple targets corresponding to (cols_y
).
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
.
inverse_transform()
Perform the inverse transformation.
OutputTrafoLog$inverse_transform(ydt)
ydt
(data.table::data.table()
)
Data. One row per observation with at least columns $cols_y
.
data.table::data.table()
with the inverse transformation applied to the columns $cols_y
.
clone()
The objects of this class are cloneable with this method.
OutputTrafoLog$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other Output Transformation:
OutputTrafo
,
OutputTrafoStandardize
,
mlr_output_trafos
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)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.