Skip to content

The option column controls options for the functions that are used to evaluate the workflow set, such as tune::fit_resamples() or tune::tune_grid(). Examples of common options to set for these functions include param_info and grid.

These functions are helpful for manipulating the information in the option column.

Usage

option_add(x, ..., id = NULL, strict = FALSE)

option_remove(x, ...)

option_add_parameters(x, id = NULL, strict = FALSE)

Arguments

x

A workflow set outputted by workflow_set() or workflow_map().

...

Arguments to pass to the tune_*() functions (e.g. tune::tune_grid()) or tune::fit_resamples(). For option_remove() this can be a series of unquoted option names.

id

A character string of one or more values from the wflow_id column that indicates which options to update. By default, all workflows are updated.

strict

A logical; should execution stop if existing options are being replaced?

Value

An updated workflow set.

Details

option_add() is used to update all of the options in a workflow set.

option_remove() will eliminate specific options across rows.

option_add_parameters() adds a parameter object to the option column (if parameters are being tuned).

Note that executing a function on the workflow set, such as tune_grid(), will add any options given to that function to the option column.

These functions do not control options for the individual workflows, such as the recipe blueprint. When creating a workflow manually, use workflows::add_model() or workflows::add_recipe() to specify extra options. To alter these in a workflow set, use update_workflow_model() or update_workflow_recipe().

Examples

library(tune)

two_class_set
#> # A workflow set/tibble: 6 × 4
#>   wflow_id      info             option    result    
#>   <chr>         <list>           <list>    <list>    
#> 1 none_cart     <tibble [1 × 4]> <opts[0]> <list [0]>
#> 2 none_glm      <tibble [1 × 4]> <opts[0]> <list [0]>
#> 3 none_mars     <tibble [1 × 4]> <opts[0]> <list [0]>
#> 4 yj_trans_cart <tibble [1 × 4]> <opts[0]> <list [0]>
#> 5 yj_trans_glm  <tibble [1 × 4]> <opts[0]> <list [0]>
#> 6 yj_trans_mars <tibble [1 × 4]> <opts[0]> <list [0]>

two_class_set %>%
  option_add(grid = 10)
#> # A workflow set/tibble: 6 × 4
#>   wflow_id      info             option    result    
#>   <chr>         <list>           <list>    <list>    
#> 1 none_cart     <tibble [1 × 4]> <opts[1]> <list [0]>
#> 2 none_glm      <tibble [1 × 4]> <opts[1]> <list [0]>
#> 3 none_mars     <tibble [1 × 4]> <opts[1]> <list [0]>
#> 4 yj_trans_cart <tibble [1 × 4]> <opts[1]> <list [0]>
#> 5 yj_trans_glm  <tibble [1 × 4]> <opts[1]> <list [0]>
#> 6 yj_trans_mars <tibble [1 × 4]> <opts[1]> <list [0]>

two_class_set %>%
  option_add(grid = 10) %>%
  option_add(grid = 50, id = "none_cart")
#> # A workflow set/tibble: 6 × 4
#>   wflow_id      info             option    result    
#>   <chr>         <list>           <list>    <list>    
#> 1 none_cart     <tibble [1 × 4]> <opts[1]> <list [0]>
#> 2 none_glm      <tibble [1 × 4]> <opts[1]> <list [0]>
#> 3 none_mars     <tibble [1 × 4]> <opts[1]> <list [0]>
#> 4 yj_trans_cart <tibble [1 × 4]> <opts[1]> <list [0]>
#> 5 yj_trans_glm  <tibble [1 × 4]> <opts[1]> <list [0]>
#> 6 yj_trans_mars <tibble [1 × 4]> <opts[1]> <list [0]>

two_class_set %>%
  option_add_parameters()
#> # A workflow set/tibble: 6 × 4
#>   wflow_id      info             option    result    
#>   <chr>         <list>           <list>    <list>    
#> 1 none_cart     <tibble [1 × 4]> <opts[1]> <list [0]>
#> 2 none_glm      <tibble [1 × 4]> <opts[0]> <list [0]>
#> 3 none_mars     <tibble [1 × 4]> <opts[1]> <list [0]>
#> 4 yj_trans_cart <tibble [1 × 4]> <opts[1]> <list [0]>
#> 5 yj_trans_glm  <tibble [1 × 4]> <opts[0]> <list [0]>
#> 6 yj_trans_mars <tibble [1 × 4]> <opts[1]> <list [0]>