Prediction Object for SurvivalSource:
This object stores the predictions returned by a learner of class LearnerSurv.
task_type is set to
True (observed) outcome.
Access the stored predicted continuous ranking.
Access the stored predicted linear predictor.
Access the stored predicted survival time.
Creates a new instance of this R6 class.
PredictionSurv$new( task = NULL, row_ids = task$row_ids, truth = task$truth(), crank = NULL, distr = NULL, lp = NULL, response = NULL, check = TRUE )
Task, used to extract defaults for
Row ids of the predicted observations, i.e. the row ids of the test set.
True (observed) response.
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.
Either a matrix of predicted survival probabilities or a distr6::VectorDistribution or a distr6::Matdist. If a matrix then column names must be given and correspond to survival times. Rows of matrix correspond to individual predictions. It is advised that the first column should be time
0with all entries
1and the last with all entries
0. If a
VectorDistributionthen each distribution in the vector should correspond to a predicted survival distribution.
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.
Numeric vector of predicted survival times. One element for each observation in the test set.
TRUE, performs argument checks and predict type conversions.
library(mlr3) task = tsk("rats") learner = lrn("surv.kaplan") p = learner$train(task, row_ids = 1:20)$predict(task, row_ids = 21:30) head(as.data.table(p)) #> row_ids time status crank distr #> 1: 21 79 FALSE 0.4616396 <list> #> 2: 22 91 FALSE 0.4616396 <list> #> 3: 23 98 FALSE 0.4616396 <list> #> 4: 24 76 FALSE 0.4616396 <list> #> 5: 25 89 FALSE 0.4616396 <list> #> 6: 26 104 FALSE 0.4616396 <list>