tidymodels / tune

Tools for tidy parameter tuning
https://tune.tidymodels.org
Other
273 stars 42 forks source link

Pass call from `select_best()` to `first_eval_time()` #820

Closed hfrick closed 7 months ago

hfrick commented 8 months ago
library(tidymodels)
library(censored)
#> Loading required package: survival

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

set.seed(2193)
tune_res <-
  proportional_hazards(penalty = tune(), engine = "glmnet") %>%
  tune_grid(
    surv ~ .,
    resamples = vfold_cv(lung_surv, 2),
    grid = 2,
    control = control_grid(save_pred = TRUE, save_workflow = TRUE),
    metrics = metric_set(brier_survival),
    eval_time = c(10, 20)
  )

# what's with the second call?
foo <- select_best(tune_res)
#> Warning in select_best(tune_res): No value of `metric` was given;
#> "brier_survival" will be used.
#> Warning: 2 evaluation times are available; the first (10) will be used.

Created on 2024-01-19 with reprex v2.0.2

github-actions[bot] commented 7 months ago

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.