Skip to contents

Wrapper around PipeOpDistrCompositor or PipeOpBreslow to simplify Graph creation.

Usage

pipeline_distrcompositor(
  learner,
  estimator = "kaplan",
  form = "aft",
  overwrite = FALSE,
  graph_learner = FALSE
)

Arguments

learner

LearnerSurv
Survival learner.

estimator

character(1)
One of kaplan (default), nelson or breslow, corresponding to the Kaplan-Meier, Nelson-Aalen and Breslow estimators respectively. Used to estimate the baseline survival distribution.

form

character(1)
One of aft (default), ph, or po, corresponding to accelerated failure time, proportional hazards, and proportional odds respectively. Used to determine the form of the composed survival distribution. Ignored if estimator is breslow.

overwrite

logical(1)
If FALSE (default) then if the learner already has a distr, the compositor does nothing. If TRUE then the distr is overwritten by the compositor if already present, which may be required for changing the prediction distr from one model form to another.

graph_learner

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

Examples

if (FALSE) {
if (requireNamespace("mlr3pipelines", quietly = TRUE) &&
  requireNamespace("rpart", quietly = TRUE)) {
  library("mlr3")
  library("mlr3pipelines")

  task = tsk("rats")
  pipe = ppl(
    "distrcompositor",
    learner = lrn("surv.rpart"),
    estimator = "kaplan",
    form = "ph"
  )
  pipe$train(task)
  pipe$predict(task)
}
}