Skip to content

better error when passing a preprocessor with a workflow #114

@topepo

Description

@topepo

Same as tidymodels/tune#912

library(tidymodels)
library(finetune)
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_sim_anneal(spline_rec, resamples = folds)
#> Warning: The `...` are not used in this function but one or more objects were
#> passed: ''
#> Optimizing rmse
#> Initial best: 2.64170
#> 1 ◯ accept suboptimal  rmse=3.5264 (+/-0.5527)
#> 2 ◯ accept suboptimal  rmse=5.7856 (+/-0.8672)
#> 3 + better suboptimal  rmse=4.1851 (+/-0.5124)
#> 4 ─ discard suboptimal rmse=5.5377 (+/-0.7899)
#> 5 + better suboptimal  rmse=3.0792 (+/-0.4582)
#> 6 ─ discard suboptimal rmse=5.2613 (+/-0.4338)
#> 7 ─ discard suboptimal rmse=3.6311 (+/-0.5161)
#> 8 ✖ restart from best  rmse=3.0093 (+/-0.4751)
#> 9 ─ discard suboptimal rmse=3.2367 (+/-0.3523)
#> 10 ─ discard suboptimal rmse=4.3919 (+/-0.6772)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementtidy-dev-day 🤓Tidyverse Developer Day rstd.io/tidy-dev-day

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions