Skip to content

Commit

Permalink
Merge pull request #861 from tidymodels/eval_time-estimate_metrics
Browse files Browse the repository at this point in the history
Remove `eval_time` from `.estimate_metrics()`
  • Loading branch information
hfrick authored Feb 29, 2024
2 parents 31e3f64 + cdc71af commit 8d621ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion R/grid_performance.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ metrics_info <- function(x) {
#' @name tune-internal-functions
#' @export
.estimate_metrics <- function(dat, metric, param_names, outcome_name, event_level,
metrics_info = metrics_info(metrics), eval_time = NULL) {
metrics_info = metrics_info(metrics)) {
# The call stack is:
#
# tune_grid_loop_iter()
Expand Down
11 changes: 5 additions & 6 deletions R/int_pctl.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ int_pctl.tune_results <- function(.data, metrics = NULL, eval_time = NULL,
purrr::map2(
config_keys, sample.int(10000, p),
~ boostrap_metrics_by_config(.x, .y, .data, metrics, times, allow_par,
event_level, eval_time, alpha)
event_level, alpha)
) %>%
purrr::list_rbind() %>%
dplyr::arrange(.config, .metric)
Expand All @@ -136,7 +136,7 @@ get_int_p_operator <- function(allow = TRUE) {
}

boostrap_metrics_by_config <- function(config, seed, x, metrics, times, allow_par,
event_level, eval_time, alpha) {
event_level, alpha) {
y_nm <- outcome_names(x)
preds <- collect_predictions(x, summarize = TRUE, parameters = config)

Expand All @@ -150,7 +150,7 @@ boostrap_metrics_by_config <- function(config, seed, x, metrics, times, allow_pa
.errorhandling = "pass",
.packages = c("tune", "rsample")
) %op% {
comp_metrics(rs$splits[[i]], y_nm, metrics, event_level, eval_time)
comp_metrics(rs$splits[[i]], y_nm, metrics, event_level)
}
if (any(grepl("survival", .get_tune_metric_names(x)))) {
# compute by evaluation time
Expand Down Expand Up @@ -219,7 +219,7 @@ get_configs <- function(x, parameters = NULL, as_list = TRUE) {
}

# Compute metrics for a specific configuration
comp_metrics <- function(split, y, metrics, event_level, eval_time) {
comp_metrics <- function(split, y, metrics, event_level) {
dat <- rsample::analysis(split)
info <- metrics_info(metrics)

Expand All @@ -230,8 +230,7 @@ comp_metrics <- function(split, y, metrics, event_level, eval_time) {
param_names = NULL,
outcome_name = y,
event_level = event_level,
metrics_info = info,
eval_time = eval_time
metrics_info = info
)

res %>%
Expand Down
3 changes: 1 addition & 2 deletions man/tune-internal-functions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8d621ca

Please sign in to comment.