mlr3proba
mlr3proba copied to clipboard
Generating survival curves obtained from survival neural networks
Is it possible to generate survival curves obtained from survival neural networks?
Hi, yes every learner that has a distr predict type returns distributions as distr6 objects which have methods for plotting, you could also use matplot to do this manually (we'll be adding matplot methods to distr6 soon) e.g.
library(mlr3proba)
#> Loading required package: mlr3
t = tsk("rats")
l = lrn("surv.coxph")$train(t)$predict(t)
# plot the first observations survival
plot(l$distr, ind = 1, fun = "survival")

# matplot all predicted survival curves
matplot(t(l$data$distr), type = "l")

Created on 2022-02-22 by the reprex package (v2.0.1)
Thank you very much for your response! We can plot individual survival curves using the code that you have suggested. Can we also generate an aggregate (single) survival curve with a confidence interval? For example, the function survfit() estimates the survival proportion, by default at the mean values of covariates for the Cox model. Do we have something similar to that?
No...but I agree this is a very good idea
Now I'm second guessing myself. Is that actually useful? What does the mean (or median) of predicted survival with confidence intervals actually tell you? ML in general is about individual predictions right? I guess if you wanted to stratify by an attribute and then plot the mean/median + CI of that attribute it could make sense but surely not for all predictions? Happy to implement something but can't work out what is/isn't useful yet
That makes sense! I would like to ask a few more questions:
-
How can we add interaction effects?
-
Suppose we perform a benchmark experiment, then how should we use the "bm" object to make predictions on the test set?
Thank you!
That makes sense!
Which option makes sense?
How can we add interaction effects?
For what?
Suppose we perform a benchmark experiment, then how should we use the "bm" object to make predictions on the test set?
You don't. Benchmark experiments are for comparing models to one another to get an idea of how they may perform in the future. Once you have a model you want to make predictions from then you should retrain it (ideally on new data but can use the same data)
Using individual predictions and generating individual survival curves make sense!
Suppose that we have a data set with covariates x, y, z and I'm interested in the interaction effect of x and y (x*y) on the response variable. How can I include that effect?
Using individual predictions and generating individual survival curves make sense!
Okay so I'll add this to mlr3viz as matlines like above. Or maybe a ggplot version to be a bit clearer
Suppose that we have a data set with covariates x, y, z and I'm interested in the interaction effect of x and y (x*y) on the response variable. How can I include that effect?
Good question. Do you mean in terms of how can you specify a formula for running a model? E.g. for linear regression you might do lm(z ~ X + y + X*y) or do you mean what models handle interaction effects (e.g. random forest) or how to plot effects?
Thank you!
Yes, I was wondering how we can specify a formula for running a model. It will be helpful if you can address the other questions as well: What models handle interaction effects and how to plot effects.
Do you have any suggestions for the interaction effects? Thank you!
Hi @nazyetimoglu! Maybe too late to be making an attempt to be answering this, but for plotting and adding a bit of explainability to survival models from mlr3proba, there is survex. Some survival models do model interaction effects, see aorsf for a recent very good implementation. Now plotting interaction effects model-agnostically, it's an active area of research, no good suggestions that come to mind right now!
Maybe you already addressed some of these issues yourself?
Closed due to inactivity