Skip to contents

Input and Output Channels

Input and output channels are inherited from PipeOpPredTransformer.

The output is the input PredictionRegr transformed to a PredictionSurv. Censoring can be added with the status hyper-parameter. se is ignored.

State

The $state is a named list with the $state elements inherited from PipeOpPredTransformer.

Parameters

The parameters are

  • status :: (numeric(1))
    If NULL then assumed no censoring in the dataset. Otherwise should be a vector of 0/1s of same length as the prediction object, where 1 is dead and 0 censored.

Methods

Inherited methods


Method new()

Creates a new instance of this R6 class.

Usage

PipeOpPredRegrSurv$new(id = "trafopred_regrsurv", param_vals = list())

Arguments

id

(character(1))
Identifier of the resulting object.

param_vals

(list())
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.

Usage

PipeOpPredRegrSurv$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

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

  # simple example
  pred = PredictionRegr$new(row_ids = 1:10, truth = 1:10, response = 1:10)
  po = po("trafopred_regrsurv")

  # assume no censoring
  new_pred = po$predict(list(pred = pred, task = NULL))[[1]]
  po$train(list(NULL, NULL))
  print(new_pred)

  # add censoring
  task_surv = tsk("rats")
  task_regr = po("trafotask_survregr", method = "omit")$train(list(task_surv, NULL))[[1]]
  learn = lrn("regr.featureless")
  pred = learn$train(task_regr)$predict(task_regr)
  po = po("trafopred_regrsurv")
  new_pred = po$predict(list(pred = pred, task = task_surv))[[1]]
  all.equal(new_pred$truth, task_surv$truth())
}
}