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

better error when passing a preprocessor with a workflow #912

Open
topepo opened this issue Jun 24, 2024 · 1 comment
Open

better error when passing a preprocessor with a workflow #912

topepo opened this issue Jun 24, 2024 · 1 comment
Labels
feature a feature request or enhancement tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day

Comments

@topepo
Copy link
Member

topepo commented Jun 24, 2024

In the code below, the tune_grid function takes a workflow and (inappropriately) a recipe. The code interprets the recipe as going to the ... and issues an unhelpful warning.

We should see if the ... contain any of the preprocessor classes and give a better error

library(tidymodels)
set.seed(6735)
folds <- vfold_cv(mtcars, v = 5)

spline_rec <-
  recipe(mpg ~ ., data = mtcars) %>%
  step_spline_natural(disp, deg_free = tune("disp")) %>%
  step_spline_natural(wt, deg_free = tune("wt"))

lin_mod <-
  linear_reg() %>%
  set_engine("lm")

spline_wflow <- workflow(spline_rec, lin_mod)

spline_grid <- expand.grid(disp = 2:5, wt = 2:5)

spline_res <-
  spline_wflow %>% 
  tune_grid(spline_rec, resamples = folds, grid = spline_grid)
#> Warning: The `...` are not used in this function but one or more objects were
#> passed: ''

Created on 2024-06-24 with reprex v2.1.0

This is probably also true of the other tune functions as well as those in finetune (tidymodels/finetune#114).

@simonpcouch
Copy link
Contributor

Related/duplicate of #829!

@hfrick hfrick added the feature a feature request or enhancement label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement tidy-dev-day 🤓 Tidyverse Developer Day rstd.io/tidy-dev-day
Projects
None yet
Development

No branches or pull requests

3 participants