how to pass event_level and verbose control parameters to tune_grid() via control_stack_grid()?

Hi: I've been enjoying tidymodels, but now trying to combine several different models via stacks: all looks good except that when I call tune_grid() I get an error from my existing parameter control = control_grid(event_level = 'second', verbose = TRUE) and instead (per the docs) I have to pass in control = control_stack_grid(). But now I don't know how to specify the event_level or verbosity. Can anyone help?

For clarity, here's the pre-stack code for a single model:

    tm.workflow %>%
        tune_grid(resamples = tm.samples,
                  grid = tm.grid,
                  metrics = metric_set(accuracy, bal_accuracy, roc_auc, kap),
                  control = control_grid(event_level = 'second', verbose = TRUE))

and here's the code for a model that's going to be included in a stack:

    tm.workflow %>%
        tune_grid(resamples = tm.samples,
                  grid = tm.grid,
                  metrics = metric_set(accuracy, bal_accuracy, roc_auc, kap),
                  control = control_stack_grid())     # how do I pass in event_level and verbose?

Thanks!

Mike

It looks like a bug. I would add an issue to the GitHub repo.

Oh, I'm an idiot: I just realised I wasn't interpreting the description in the docs (Control wrappers — control_stack_grid • stacks) correctly; it turns out I don't have to call control_stack_grid(): I just have to append save_pred = TRUE and save_workflow = TRUE to my existing call to control_grid(): this actually works:

    tm.workflow %>%
        tune_grid(resamples = tm.samples,
                  grid = tm.grid,
                  metrics = metric_set(accuracy, bal_accuracy, roc_auc, kap),
                  control = control_grid(event_level = 'second', verbose = TRUE,
                                         save_pred = TRUE, save_workflow = TRUE))

I guess the docs are not quite as clear as they could be (for me, at first glance, at any rate!), but no bug as such. I'll close this.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.