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

support tuning postprocessors in workflows #266

Merged
merged 3 commits into from
Oct 21, 2024
Merged

Conversation

simonpcouch
Copy link
Contributor

Related to tidymodels/tailor#51.

@topepo
Copy link
Member

topepo commented Oct 16, 2024

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
Contributor Author

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

@simonpcouch simonpcouch merged commit 927df77 into main Oct 21, 2024
11 checks passed
@simonpcouch simonpcouch deleted the tuning-postprocessors branch October 21, 2024 14:59
Copy link

github-actions bot commented Nov 6, 2024

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