-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move flexsurv and parametric to {survivalmodels} #41
Comments
This shouldn't be closed. There is too much glue code in these learners. But I can transfer the issue to {survivalmodels} |
Is there any plan on doing this? :) |
@RaphaelS1 can you please transfer the issue (I am trying to clean house right now) |
Meeting with John today. Will discuss then. |
@bblodfon I tried to use the new library(mlr3verse)
#> Loading required package: mlr3
library(mlr3extralearners)
set.seed(237498324)
l = lrn("surv.flexible")
t = tsk("rats")
split = partition(t)
# train learner
l$train(t, row_ids = split$train)
## 1) using extralearners method
pred = l$predict(t, row_ids = split$test)
## 2) using flexsurv method
# get survival probabilities
p = predict(l$model, type = "surv", newdata = t$data(split$test))$.pred
# check all times the same
times = p[[1]]$.time
x = all(unlist(lapply(p, function(.x) all.equal(times, .x$.time))))
ut = unique(times)
if (x) {
# remove survival probabilities at duplicated time points
dup = !duplicated(times)
surv = t(vapply(
p, function(.x) .x$.pred_survival[dup],
numeric(length(ut))
))
colnames(surv) = ut
# create Matdist
out = distr6::as.Distribution(1 - surv, fun = "cdf", decorators = "ExoticStatistics")
}
## 3) compare
matplot(as.data.frame(round(pred$distr$survival(1:100), 4)), type = "l") matplot(as.data.frame(round(out$survival(1:100), 4)), type = "l") Created on 2023-10-20 with reprex v2.0.2 |
I checked the example and I also think we should use the What about the |
Thanks @bblodfon could you you open a PR to update flexsurv then (which is primarily deleting code!) And I'll review parametric today |
@sebffischer @bblodfon I'm working on this in 2 steps. First I'm adding a new implementation of predict for survreg and will ask @bblodfon to review - we can keep it on branch. Once that's passing and we're happy I'll then move everything to survivalmodels. This is just to reduce moving parts |
Need this first => RaphaelS1/survivalmodels#45 |
closed via #345 |
@jemus42 FYI, only thing that has changed is that |
Hmm our benchmark has an |
when I use |
Yeah that's what I mean, the lock file currently enforces an older version (0cbdb72) and I'm wondering now if I should bother updating or just leave it, as the actual compute part is done now. |
Nah, just leave it |
No description provided.
The text was updated successfully, but these errors were encountered: