Skip to content

add early exits in .model_param_name_key() #1280

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EmilHvitfeldt
Copy link
Member

Follow up on tidymodels/tune#1071.

If there isn't any tuning parameters set in a workflow, we can early exit, which for the following example leads to an almost 20% speed increase

After

library(tidymodels)
ames <- ames |>
  select(where(is.numeric))

svm_spec <- null_model(mode = "regression")

set.seed(1)
cv1 <- rsample::bootstraps(ames)

set.seed(1)

bench::mark(
  run = fit_resamples(
    svm_spec,
    Sale_Price ~ .,
    cv1, metrics = metric_set(yardstick::rmse),
    control = control_grid(save_pred = TRUE)
  ), iterations = 10
)
#> Warning: Some expressions had a GC in every iteration; so filtering is
#> disabled.
#> # A tibble: 1 × 6
#>   expression      min   median `itr/sec` mem_alloc `gc/sec`
#>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl>
#> 1 run           378ms    388ms      2.41     162MB     10.4

Created on 2025-08-01 with reprex v2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant