0

I’m using {workflowsets} from {tidymodels} for the first time, and I’m following along chapter in Tidy Modeling with R.

In the book, the authors use a fixed, regular grid hyperparameter search:

grid_results <-
   all_workflows %>%
    workflow_map(
        fn = "tune_grid",
        seed = 1503,
        resamples = concrete_folds,
        grid = 25, # See note below
        control = grid_ctrl
   )

Help for the tune::tune_grid() function specifies that “[a]n integer denotes the number of candidate parameter sets to be created automatically.”

While this has worked for me, I wanted to try a space-filling design, such as those created with dials::grid_max_entropy. However, this function (much like all grid-generating functions in {tune}) requires a param or parameter set object.

How can I extract parameters en bloc from a workflow set, seeing as how there is no parameters method for workflowsets (yet)?

Thanks!

Edit: added fn argument to workflow_map for clarity, even though it’s not present in the book (tune_grid is the default value for the arg).

Marco B
  • 121
  • 6

1 Answers1

1

I'm quoting the answer of Max Kuhn in this GitHub issue

The best approach is to use option_add(). There is an example in the upcoming blog post that does this (but to define a custom parameter range for the grid). You could do:

wflow_set <- 
  wflow_set %>% 
  option_add(grid = some_grid, id = "some wflow_id") 

Also, I found this presentation by Max Kuhn very useful. Namely slide 24 illustrates "Passing individual options to models". This is the YouTube link of the presentation (https://www.youtube.com/watch?v=2OfTEakSFXQ)

hnagaty
  • 796
  • 5
  • 13