Skip to content
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

multi_predict(type = "survival") is missing penalty column for single penalty value #267

Closed
hfrick opened this issue May 4, 2023 · 2 comments · Fixed by #282
Closed
Labels
bug an unexpected problem or unintended behavior

Comments

@hfrick
Copy link
Member

hfrick commented May 4, 2023

library(censored)
#> Loading required package: parsnip
#> Loading required package: survival
lung2 <- lung[-14, ]

set.seed(14)
f_fit <- proportional_hazards(penalty = 0.123) %>%
  set_mode("censored regression") %>%
  set_engine("glmnet") %>%
  fit(Surv(time, status) ~ age + ph.ecog, data = lung2)

pred_multi <- multi_predict(f_fit,new_data = lung2[1:3, ], type = "survival",
  eval_time = c(100, 200), penalty = 0.1)

# this should have a penalty column
pred_multi$.pred[[1]]
#> # A tibble: 2 × 2
#>   .eval_time .pred_survival
#>        <dbl>          <dbl>
#> 1        100          0.868
#> 2        200          0.680

Created on 2023-05-04 with reprex v2.0.2

@hfrick hfrick added the bug an unexpected problem or unintended behavior label May 4, 2023
@hfrick
Copy link
Member Author

hfrick commented Dec 15, 2023

This currently doesn't work because survival_prob_coxnet() reconstructs multi from the length of the penalty, which does not allow us to specify multi = TRUE and a penalty with a single value.

The plan is to give survival_prob_coxnet() its own multi arg and call it directly from multi_predict(). We can't go through predict() as we do now because predict() won't let us pass the multi argument through. We will need to add to multi_predict() any checks on the type (and the like) that are carried out by predict().

Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant