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(), distr = NULL,
risk = NULL, lp = 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.

  • lp :: numeric()
    Vector of linear predictor scores. One element for each observation in the test set. lp = exp(risk). Used in measures like mlr_measures_surv.harrells_c.

  • distr :: distr6::Distribution()
    List of R6 distributions. One distribution for each observation in the test set. Each distribution contains the hazard, survival, and cumulative hazard (and other common functions) for all predictions. Used in measures like mlr_measures_surv.brier.

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 distr #> 1: 1 306 TRUE 1.8165846 <WeightedDiscrete> #> 2: 2 455 TRUE 1.8165846 <WeightedDiscrete> #> 3: 3 1010 FALSE 0.6019784 <WeightedDiscrete> #> 4: 4 210 TRUE 2.0298656 <WeightedDiscrete> #> 5: 5 883 TRUE 0.6019784 <WeightedDiscrete> #> 6: 6 1022 FALSE 0.8886228 <WeightedDiscrete>