Skip to contents

Wrapper around PipeOpTaskSurvClassifDiscTime and PipeOpPredClassifSurvDiscTime to simplify Graph creation.

Usage

pipeline_survtoclassif_disctime(
  learner,
  cut = NULL,
  max_time = NULL,
  rhs = NULL,
  graph_learner = FALSE
)

Arguments

learner

LearnerClassif
Classification learner to fit the transformed TaskClassif. learner must have predict_type of type "prob".

cut

(numeric())
Split points, used to partition the data into intervals. If unspecified, all unique event times will be used. If cut is a single integer, it will be interpreted as the number of equidistant intervals from 0 until the maximum event time.

max_time

(numeric(1))
If cut is unspecified, this will be the last possible event time. All event times after max_time will be administratively censored at max_time.

rhs

(character(1))
Right-hand side of the formula to use with the learner. All features of the task are available as well as tend the upper bounds of the intervals created by cut. If rhs is unspecified, the formula of the task will be used.

graph_learner

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

Details

The pipeline consists of the following steps:

  1. PipeOpTaskSurvClassifDiscTime Converts TaskSurv to a TaskClassif.

  2. A LearnerClassif is fit and predicted on the new TaskClassif.

  3. PipeOpPredClassifSurvDiscTime transforms the resulting PredictionClassif to PredictionSurv.

  4. Optionally: PipeOpModelMatrix is used to transform the formula of the task before fitting the learner.

Dictionary

This Graph can be instantiated via the dictionary mlr_graphs or with the associated sugar function ppl():

mlr_graphs$get("survtoclassif_disctime")
ppl("survtoclassif_disctime")

Examples

if (FALSE) { # \dontrun{
  library(mlr3)
  library(mlr3learners)
  library(mlr3pipelines)

  task = tsk("lung")
  part = partition(task)

  grlrn = ppl(
    "survtoclassif_disctime",
    learner = lrn("classif.log_reg"),
    cut = 4, # 4 equidistant time intervals
    graph_learner = TRUE
  )
  grlrn$train(task, row_ids = part$train)
  grlrn$predict(task, row_ids = part$test)
} # }