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

Integrated survival metrics should warn when used with a single time point in eval_time #460

Closed
hfrick opened this issue Nov 22, 2023 · 2 comments · Fixed by #467
Closed
Assignees
Labels
feature a feature request or enhancement

Comments

@hfrick
Copy link
Member

hfrick commented Nov 22, 2023

library(censored)
#> Loading required package: parsnip
#> Loading required package: survival
library(yardstick)

lung_surv <- lung %>% 
  dplyr::mutate(surv = Surv(time, status), .keep = "unused")

cox <- proportional_hazards() %>% 
  fit(surv ~ ., data = lung_surv)

pred <- augment(cox, lung_surv, eval_time = 10)

brier_survival_integrated(
  data = pred,
  truth = surv,
  .pred
)
#> # A tibble: 1 × 3
#>   .metric                   .estimator .estimate
#>   <chr>                     <chr>          <dbl>
#> 1 brier_survival_integrated standard           0

Created on 2023-11-22 with reprex v2.0.2

@topepo
Copy link
Member

topepo commented Dec 7, 2023

After discussing during the tidymodels meeting, we should error if an integrated metric is used with <2 times. The more generic code that tune uses is

 cli::cli_abort("At least {max_times_req} evaluation time{?s} {?is/are}
                   required for the metric type(s) requested: {.val {uni_cls}}.
                   Only {num_times} unique time{?s} {?was/were} given.",
                   call = call)

You can use a more simplistic version of this.

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 Dec 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants