This object stores the predictions returned by a learner of class LearnerSurv.

The task_type is set to "surv".

Format

R6::R6Class object inheriting from mlr3::Prediction.

Construction

p = PredictionSurv$new(task = NULL, row_ids = task$row_ids,
  truth = task$truth(), risk = NULL)
  • task :: TaskSurv
    Task, used to extract defaults for row_ids and truth.

  • row_ids :: (integer() | character())
    Row ids of the task. Per default, these are extracted from the task.

  • truth :: survival::Surv()
    Observed survival times. Per default, these are extracted from the task.

  • risk :: numeric()
    Vector of risk scores. One element for each observation in the test set. The higher the risk, the more likely is an event. Used in measures like mlr_measures_surv.harrells_c.

Fields

See mlr3::Prediction.

The field task_type is set to "surv".

Examples

library(mlr3) task = mlr_tasks$get("lung") learner = mlr_learners$get("surv.rpart") p = learner$train(task)$predict(task) head(as.data.table(p))
#> row_id time status risk #> 1: 1 306 TRUE 1.8165846 #> 2: 2 455 TRUE 1.8165846 #> 3: 3 1010 FALSE 0.6019784 #> 4: 4 210 TRUE 2.0298656 #> 5: 5 883 TRUE 0.6019784 #> 6: 6 1022 FALSE 0.8886228