Skip to contents

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 a Learner which will be wrapped in mlr3pipelines::PipeOpLearner, a PipeOp which will be wrapped in mlr3pipelines::Graph or a Graph itself. Underlying Learner 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)
If TRUE (default) predictions are aggregated with PipeOpSurvAvg, otherwise returned as multiple predictions. Can only be FALSE if graph_learner = FALSE.

weights

numeric()
Weights for model avering, ignored if avg = FALSE. Default is uniform weighting, see PipeOpSurvAvg.

graph_learner

logical(1)
If TRUE returns wraps the Graph as a GraphLearner otherwise (default) returns as a Graph.

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)
}
}