mlr3: obtaining response (predicted survival time) from surv.gbm

353 views Asked by At

surv.gbm in the mlr3 framework outputs linear predictors, however what I'm really interested in are predicted survival times per case, which I want to compare with the actual survival times. Is there a way to obtain actual survival times?

In the mlr3 book, there is an example of a transformation between linear predictors and a distribution.

pod = po("distrcompose", param_vals = list(form = "ph", overwrite = FALSE))
prediction = pod$predict(list(base = prediction_distr, pred = prediction_lp))$output

Is there a way to change this pipeline so that it converts "lp" to "response" ?

Any help would be appriciated.

1

There are 1 answers

6
RaphaelS On BEST ANSWER

Yes this is definitely possible it just requires another transformation. Your first step is correct to compose a distribution from a linear predictor; as you're using surv.gbm only Cox PH is possible as the underlying model so default for distrcompose works for this.

Now you need to use crankcompose in order to create a survival time prediction from the distribution, you could use the mean, median, or mode of the distribution, people usually pick mean or median but that's your choice! Just make sure to include response = TRUE, overwrite = FALSE. Example code below, includes creating predictions and scoring with RMSE (surprisingly quite good!). I think the book may need updating...

Thanks, Raphael

library(mlr3extralearners)
library(mlr3proba)
library(mlr3pipelines)
library(mlr3)

learn =  ppl("crankcompositor", ppl("distrcompositor", lrn("surv.gbm")),
             response = TRUE, overwrite = FALSE, method = "mean",
             graph_learner = TRUE)
set.seed(1)
task = tgen("simsurv")$generate(50)
learn$train(task)
p = learn$predict(task)
p$score(msr("surv.rmse"))