Skip to content

support tuning postprocessors in workflows - #266

Merged
simonpcouch merged 3 commits into
mainfrom
tuning-postprocessors
Oct 21, 2024
Merged

support tuning postprocessors in workflows#266
simonpcouch merged 3 commits into
mainfrom
tuning-postprocessors

Conversation

@simonpcouch

Copy link
Copy Markdown
Contributor

Related to tidymodels/tailor#51.

@topepo

topepo commented Oct 16, 2024

Copy link
Copy Markdown
Member

I think that there might be some merging issues with the results of tune_args()?

library(tidymodels)
library(tailor)
ad_rec <- 
  recipe(Class ~ ., data = ad_data) %>% 
  step_dummy(all_factor_predictors()) %>% 
  step_zv(all_predictors()) %>% 
  step_normalize(all_numeric_predictors()) %>% 
  step_pca(all_numeric_predictors(), num_comp = tune())
  
glmn_spec <- logistic_reg(penalty = tune()) %>% set_mode("classification") %>% set_engine("glmnet")

post <- tailor() %>% adjust_probability_threshold(threshold = tune())

wflow <- workflow(ad_rec, glmn_spec, post)
tunable(wflow)
#> # A tibble: 4 × 5
#>   name      call_info        source     component    component_id
#>   <chr>     <list>           <chr>      <chr>        <chr>       
#> 1 penalty   <named list [2]> model_spec logistic_reg main        
#> 2 mixture   <named list [3]> model_spec logistic_reg main        
#> 3 num_comp  <named list [3]> recipe     step_pca     pca_Dnt4n   
#> 4 threshold <named list [2]> recipe     step_pca     pca_Dnt4n

Created on 2024-10-16 with reprex v2.1.1

step_pca() also has a potential argument called threshold.

@simonpcouch

Copy link
Copy Markdown
Contributor Author

Good thought to make sure we test that explicitly! Added in d3417d2.

@simonpcouch
simonpcouch merged commit 927df77 into main Oct 21, 2024
@simonpcouch
simonpcouch deleted the tuning-postprocessors branch October 21, 2024 14:59
@github-actions

github-actions Bot commented Nov 6, 2024

Copy link
Copy Markdown

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions Bot locked and limited conversation to collaborators Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants