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

The task_type is set to "surv".

See also

Other Prediction: PredictionDens

Super class

mlr3::Prediction -> PredictionSurv

Active bindings

truth

(Surv)
True (observed) outcome.

crank

(numeric())
Access the stored predicted continuous ranking.

distr

(VectorDistribution)
Access the stored predicted survival distribution.

lp

(numeric())
Access the stored predicted linear predictor.

response

(numeric())
Access the stored predicted survival time.

missing

(integer())
Returns row_ids for which the predictions are missing or incomplete.

Methods

Public methods

Inherited methods

Method new()

Creates a new instance of this R6 class.

Usage

PredictionSurv$new(
  task = NULL,
  row_ids = task$row_ids,
  truth = task$truth(),
  crank = NULL,
  distr = NULL,
  lp = NULL,
  response = NULL
)

Arguments

task

(TaskSurv)
Task, used to extract defaults for row_ids and truth.

row_ids

(integer())
Row ids of the predicted observations, i.e. the row ids of the test set.

truth

(numeric())
True (observed) response.

crank

(numeric())
Numeric vector of predicted continuous rankings (or relative risks). 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.

distr

(VectorDistribution)
VectorDistribution from distr6. Each individual distribution in the vector represents the random variable 'survival time' for an individual observation.

lp

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

response

(numeric())
Numeric vector of predicted survival times. One element for each observation in the test set.


Method clone()

The objects of this class are cloneable with this method.

Usage

PredictionSurv$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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 3.401055 TRUE 0.5873374 NA #> 2: 2 5.000000 FALSE 0.5873374 NA #> 3: 3 2.648617 TRUE 0.5873374 NA #> 4: 4 5.000000 FALSE 0.5873374 NA #> 5: 5 5.000000 FALSE 0.5873374 NA #> 6: 6 0.848261 TRUE 1.6402388 NA