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

PredictionSurv$new(task = NULL, row_ids = task$row_ids, truth = task$truth(),
                   crank = NULL, distr = 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.

  • crank :: numeric()
    Vector of continuous ranks. One element for each observation in the test set. For a pair of continuous ranks, a higher rank indicates that the observation is more likely to experience the event. Used in discrimination measures like surv.harrellC.

  • distr :: distr6::Distribution()
    VectorDistribution from distr6. Each individual distribution in the vector represents the random variable 'survival time' for an individual observation. Used in measures like surv.graf.

  • lp :: numeric()
    Vector of linear predictor scores. One element for each observation in the test set. \(lp = X\beta\) where \(X\) is a matrix of covariates and \(\beta\) is a vector of estimated coefficients. Used in discrimination measures like surv.harrellC.

Fields

See mlr3::Prediction.

The field task_type is set to "surv".

Examples

library(mlr3) task = tgen("simsurv")$generate(20) learner = mlr_learners$get("surv.rpart") p = learner$train(task)$predict(task) head(as.data.table(p))
#> row_id time status crank distr #> 1: 1 4.272501 TRUE 1.989096 <VectorDistribution> #> 2: 2 5.000000 FALSE 1.095800 <VectorDistribution> #> 3: 3 1.930479 TRUE 1.095800 <VectorDistribution> #> 4: 4 2.768952 TRUE 1.989096 <VectorDistribution> #> 5: 5 3.523663 TRUE 1.095800 <VectorDistribution> #> 6: 6 1.577877 TRUE 1.095800 <VectorDistribution>