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

add multi arg to survival_prob_coxnet() #279

Merged
merged 5 commits into from
Dec 20, 2023
Merged

Conversation

hfrick
Copy link
Member

@hfrick hfrick commented Dec 18, 2023

This is part 1 of #267

This does break multi_predict(type = "survival") temporarily but I think it'll be easier to review when the necessary changes to multi_predict() are coming in the next PR.

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 <- survival_prob_coxnet(f_fit, new_data = lung2[1:3, c("age", "ph.ecog")],
                            eval_time = c(100, 200), penalty = 0.1, multi = TRUE)

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

Created on 2023-12-18 with reprex v2.0.2

@hfrick hfrick requested a review from EmilHvitfeldt December 18, 2023 19:01
R/aaa_survival_prob.R Outdated Show resolved Hide resolved
R/aaa_survival_prob.R Outdated Show resolved Hide resolved
R/proportional_hazards-glmnet.R Outdated Show resolved Hide resolved
R/proportional_hazards-glmnet.R Outdated Show resolved Hide resolved
@hfrick hfrick merged commit 31a3741 into main Dec 20, 2023
8 checks passed
@hfrick hfrick deleted the survival_prob_coxnet-multi-arg branch December 20, 2023 10:52
Copy link

github-actions bot commented Jan 4, 2024

This pull request 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 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants