Wrapper around PipeOpSubsample and PipeOpSurvAvg to simplify Graph creation.
Usage
pipeline_survbagging(
learner,
iterations = 10,
frac = 0.7,
avg = TRUE,
weights = 1,
graph_learner = FALSE
)
Arguments
- learner
[mlr3::Learner]|[mlr3pipelines::PipeOp]|[mlr3pipelines::Graph]
Either aLearner
which will be wrapped in mlr3pipelines::PipeOpLearner, aPipeOp
which will be wrapped in mlr3pipelines::Graph or aGraph
itself. UnderlyingLearner
should be LearnerSurv.- iterations
integer(1)
Number of bagging iterations. Defaults to 10.- frac
numeric(1)
Percentage of rows to keep during subsampling. See PipeOpSubsample for more information. Defaults to 0.7.- avg
logical(1)
IfTRUE
(default) predictions are aggregated with PipeOpSurvAvg, otherwise returned as multiple predictions. Can only beFALSE
ifgraph_learner = FALSE
.- weights
numeric()
Weights for model avering, ignored ifavg = FALSE
. Default is uniform weighting, see PipeOpSurvAvg.- graph_learner
logical(1)
IfTRUE
returns wraps the Graph as a GraphLearner otherwise (default) returns as aGraph
.
Details
Bagging (Bootstrap AGGregatING) is the process of bootstrapping data and aggregating
the final predictions. Bootstrapping splits the data into B
smaller datasets of a given size
and is performed with PipeOpSubsample. Aggregation is
the sample mean of deterministic predictions and a
MixtureDistribution of distribution predictions. This can be
further enhanced by using a weighted average by supplying weights
.
Examples
if (FALSE) {
if (requireNamespace("mlr3pipelines", quietly = TRUE)) {
library("mlr3")
library("mlr3pipelines")
task = tsk("rats")
pipe = ppl(
"survbagging",
learner = lrn("surv.coxph"),
iterations = 5,
graph_learner = FALSE
)
pipe$train(task)
pipe$predict(task)
}
}