recipes icon indicating copy to clipboard operation
recipes copied to clipboard

`tune_args.recipe` doesn't include un-tunable arguments marked for tuning

Open simonpcouch opened this issue 4 months ago • 0 comments

Related to tidymodels/tune#660. It looks like, currently, tune_args() doesn't include arguments marked for tuning if they're not tunable.

library(tidymodels)

rec <- 
  recipe(Price ~ ., data = credit_data) %>%
  step_impute_bag(
    Status, Home, Marital, Job, Income, Assets, Debt,
    # tunable
    trees = tune(),
    # not known tunable
    options = tune()
  )

credit_wflow <- workflow(rec, linear_reg())

# correct - we only have parameter info for trees
tunable(credit_wflow)
#> # A tibble: 1 × 5
#>   name  call_info        source component       component_id    
#>   <chr> <list>           <chr>  <chr>           <chr>           
#> 1 trees <named list [3]> recipe step_impute_bag impute_bag_EUEU7

# incorrect - doesn't include `options` from recipe
tune_args(credit_wflow)
#> # A tibble: 1 × 6
#>   name  tunable id    source component       component_id    
#>   <chr> <lgl>   <chr> <chr>  <chr>           <chr>           
#> 1 trees TRUE    trees recipe step_impute_bag impute_bag_EUEU7

Created on 2024-04-03 with reprex v2.1.0

simonpcouch avatar Apr 03 '24 20:04 simonpcouch