Extras - workflowsets

Introduction to tidymodels

How can we compare multiple model workflows at once?

Evaluate a workflow set

workflow_set(list(tip ~ .), list(tree_spec, rf_spec))
#> # A workflow set/tibble: 2 × 4
#>   wflow_id              info             option    result    
#>   <chr>                 <list>           <list>    <list>    
#> 1 formula_decision_tree <tibble [1 × 4]> <opts[0]> <list [0]>
#> 2 formula_rand_forest   <tibble [1 × 4]> <opts[0]> <list [0]>

Evaluate a workflow set

workflow_set(list(tip ~ .), list(tree_spec, rf_spec)) %>%
  workflow_map("fit_resamples", resamples = taxi_folds)
#> # A workflow set/tibble: 2 × 4
#>   wflow_id              info             option    result   
#>   <chr>                 <list>           <list>    <list>   
#> 1 formula_decision_tree <tibble [1 × 4]> <opts[1]> <rsmp[+]>
#> 2 formula_rand_forest   <tibble [1 × 4]> <opts[1]> <rsmp[+]>

Evaluate a workflow set

workflow_set(list(tip ~ .), list(tree_spec, rf_spec)) %>%
  workflow_map("fit_resamples", resamples = taxi_folds) %>%
  rank_results()
#> # A tibble: 4 × 9
#>   wflow_id          .config .metric  mean std_err     n preprocessor model  rank
#>   <chr>             <chr>   <chr>   <dbl>   <dbl> <int> <chr>        <chr> <int>
#> 1 formula_decision… Prepro… accura… 0.915 0.00309    10 formula      deci…     1
#> 2 formula_decision… Prepro… roc_auc 0.624 0.0105     10 formula      deci…     1
#> 3 formula_rand_for… Prepro… accura… 0.924 0.00326    10 formula      rand…     2
#> 4 formula_rand_for… Prepro… roc_auc 0.615 0.0151     10 formula      rand…     2

The first metric of the metric set is used for ranking. Use rank_metric to change that.

Lots more available with workflow sets, like collect_metrics(), autoplot() methods, and more!

Your turn

When do you think a workflow set would be useful?

03:00