This object stores the predictions returned by a learner of class LearnerSurv.
The task_type
is set to "surv"
.
mlr3::Prediction
-> PredictionSurv
truth
(Surv
)
True (observed) outcome.
crank
(numeric()
)
Access the stored predicted continuous ranking.
distr
(distr6::Matdist|distr6::VectorDistribution) Convert the stored survival matrix to a survival distribution.
lp
(numeric()
)
Access the stored predicted linear predictor.
response
(numeric()
)
Access the stored predicted survival time.
new()
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
(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
(survival::Surv()
)
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
(matrix()|[distr6::Matdist]|[distr6::VectorDistribution]
)
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 0
with all entries 1
and the last
with all entries 0
. If a VectorDistribution
then each distribution in the vector
should correspond to a predicted survival distribution.
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.
check
(logical(1)
)
If TRUE
, performs argument checks and predict type conversions.
clone()
The objects of this class are cloneable with this method.
PredictionSurv$clone(deep = FALSE)
deep
Whether to make a deep clone.
Other Prediction:
PredictionDens
# NOT RUN {
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))
# }
Run the code above in your browser using DataLab