mlr_pipeops_compose_probregr | R Documentation |
Combines a predicted reponse
and se
from PredictionRegr with a specified probability
distribution to estimate (or 'compose') a distr
prediction.
This PipeOp can be instantiated via the
dictionary mlr3pipelines::mlr_pipeops or with the associated sugar
function mlr3pipelines::po()
:
PipeOpProbregrCompositor$new() mlr_pipeops$get("compose_probregr") po("compose_probregr")
PipeOpProbregrCompositor has two input channels named "input_response"
and "input_se"
,
which take NULL
during training and two PredictionRegrs during prediction, these should
respectively contain the response
and se
return type, the same object can be passed twice.
The output during prediction is a PredictionRegr with the "response" from input_response
,
the "se" from input_se
and a "distr" created from combining the two.
The $state
is left empty (list()
).
dist
:: character(1)
Location-scale distribution to use for composition. Current choices are "Normal"
(default),
"Cauchy"
, "Gumbel"
, "Laplace"
, "Logistic"
. All implemented via distr6.
The composition is created by substituting the response
and se
predictions into the
distribution location and scale parameters respectively.
mlr3pipelines::PipeOp
-> PipeOpProbregrCompositor
new()
Creates a new instance of this R6 class.
PipeOpProbregrCompositor$new( id = "compose_probregr", param_vals = list(dist = "Normal") )
id
(character(1)
)
Identifier of the resulting object.
param_vals
(list()
)
List of hyperparameter settings, overwriting the hyperparameter settings that would
otherwise be set during construction.
clone()
The objects of this class are cloneable with this method.
PipeOpProbregrCompositor$clone(deep = FALSE)
deep
Whether to make a deep clone.
## Not run: if (requireNamespace("mlr3pipelines", quietly = TRUE) && requireNamespace("rpart", quietly = TRUE)) { library(mlr3) library(mlr3pipelines) set.seed(1) task = tsk("boston_housing") # Option 1: Use a learner that can predict se learn = lrn("regr.featureless", predict_type = "se") pred = learn$train(task)$predict(task) poc = po("compose_probregr") poc$predict(list(pred, pred))[[1]] # Option 2: Use two learners, one for response and the other for se learn_response = lrn("regr.rpart") learn_se = lrn("regr.featureless", predict_type = "se") pred_response = learn_response$train(task)$predict(task) pred_se = learn_se$train(task)$predict(task) poc = po("compose_probregr") poc$predict(list(pred_response, pred_se))[[1]] } ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.