Skip to contents

Transform TaskSurv to TaskRegr.

Input and Output Channels

Input and output channels are inherited from PipeOpTaskTransformer.

The output is the input TaskSurv transformed to a TaskRegr.


The $state is a named list with the $state elements

  • instatus: Censoring status from input training task.

  • outstatus : Censoring status from input prediction task.


The parameters are

  • method::character(1))
    Method to use for dealing with censoring. Options are "ipcw" (Vock et al., 2016): censoring is column is removed and a weights column is added, weights are inverse estimated survival probability of the censoring distribution evaluated at survival time; "mrl" (Klein and Moeschberger, 2003): survival time of censored observations is transformed to the observed time plus the mean residual life-time at the moment of censoring; "bj" (Buckley and James, 1979): Buckley-James imputation assuming an AFT model form, calls bujar::bujar; "delete": censored observations are deleted from the data-set - should be used with caution if censoring is informative; "omit": the censoring status column is deleted - again should be used with caution; "reorder": selects features and targets and sets the target in the new task object. Note that "mrl" and "ipcw" will perform worse with Type I censoring.

  • estimator::(character(1))
    Method for calculating censoring weights or mean residual lifetime in "mrl", current options are: "kaplan": unconditional Kaplan-Meier estimator; "akritas": conditional non-parameteric nearest-neighbours estimator; "cox".

  • alpha::(numeric(1))
    When ipcw is used, optional hyper-parameter that adds an extra penalty to the weighting for censored observations. If set to 0 then censored observations are given zero weight and deleted, weighting only the non-censored observations. A weight for an observation is then \((\delta + \alpha(1-\delta))/G(t)\) where \(\delta\) is the censoring indicator.

  • eps::numeric(1)
    Small value to replace 0 survival probabilities with in IPCW to prevent infinite weights.

  • lambda::(numeric(1))
    Nearest neighbours parameter for the "akritas" estimator in the mlr3extralearners package, default 0.5.

  • features, target :: character())
    For "reorder" method, specify which columns become features and targets.

  • learner cneter, mimpu,, max.cycle, mstop, nu
    Passed to bujar::bujar.


Buckley, Jonathan, James, Ian (1979). “Linear Regression with Censored Data.” Biometrika, 66(3), 429–436. doi:10.2307/2335161 ,

Klein, P J, Moeschberger, L M (2003). Survival analysis: techniques for censored and truncated data, 2 edition. Springer Science & Business Media. ISBN 0387216456.

Vock, M D, Wolfson, Julian, Bandyopadhyay, Sunayan, Adomavicius, Gediminas, Johnson, E P, Vazquez-Benitez, Gabriela, O'Connor, J P (2016). “Adapting machine learning techniques to censored time-to-event health record data: A general-purpose approach using inverse probability of censoring weighting.” Journal of Biomedical Informatics, 61, 119–131. doi:10.1016/j.jbi.2016.03.009 ,


Inherited methods

Method new()

Creates a new instance of this R6 class.


PipeOpTaskSurvRegr$new(id = "trafotask_survregr", param_vals = list())



Identifier of the resulting object.


List of hyperparameter settings, overwriting the hyperparameter settings that would otherwise be set during construction.

Method clone()

The objects of this class are cloneable with this method.


PipeOpTaskSurvRegr$clone(deep = FALSE)



Whether to make a deep clone.


if (FALSE) { # \dontrun{
if (requireNamespace("mlr3pipelines", quietly = TRUE)) {

  # these methods are generally only successful if censoring is not too high
  # create survival task by undersampling
  task = tsk("rats")$filter(
    c(which(tsk("rats")$truth()[, 2] == 1),
      sample(which(tsk("rats")$truth()[, 2] == 0), 42))

  # deletion
  po = po("trafotask_survregr", method = "delete")
  po$train(list(task, NULL))[[1]] # 42 deleted

  # omission
  po = po("trafotask_survregr", method = "omit")
  po$train(list(task, NULL))[[1]]

  if (requireNamespace("mlr3extralearners", quietly = TRUE)) {
    # ipcw with Akritas
    po = po("trafotask_survregr", method = "ipcw", estimator = "akritas", lambda = 0.4, alpha = 0)
    new_task = po$train(list(task, NULL))[[1]]

  # mrl with Kaplan-Meier
  po = po("trafotask_survregr", method = "mrl")
  new_task = po$train(list(task, NULL))[[1]]
  data.frame(new = new_task$truth(), old = task$truth())

  # Buckley-James imputation
  if (requireNamespace("bujar", quietly = TRUE)) {
    po = po("trafotask_survregr", method = "bj")
    new_task = po$train(list(task, NULL))[[1]]
    data.frame(new = new_task$truth(), old = task$truth())

  # reorder - in practice this will be only be used in a few graphs
  po = po("trafotask_survregr", method = "reorder", features = c("sex", "rx", "time", "status"),
    target = "litter")
  new_task = po$train(list(task, NULL))[[1]]

  # reorder using another task for feature names
  po = po("trafotask_survregr", method = "reorder", target = "litter")
  new_task = po$train(list(task, task))[[1]]
} # }