tidymodels / stacks

An R package for tidy stacked ensemble modeling
https://stacks.tidymodels.org
Other
295 stars 27 forks source link

Unclear error message of add_candidates(): The inputted `candidates` argument was not generated #227

Closed MatthieuStigler closed 1 month ago

MatthieuStigler commented 1 month ago

Using add_candidates(), I obtained the following error message:

Error in add_candidates(): ! The inputted candidates argument was not generated with the appropriate control settings. Please see control_stack().

After a lot of guessing, I understood that the problem was that I had generated control_grid(save_pred = FALSE) but I don't think the error message will lead a user to that conclusion?

  1. The error message leads to control_stack(), which doesn't seem to exist?
  2. If the user goes to control_stack_grid() instead, the help file has no example, nor description of inputs of the function, making it very hard to diagnostic the problem

So based on this, it does not seem to me that the actual error message will lead the user to understand that the problem was using control_grid(save_pred = FALSE)?

Thanks!

simonpcouch commented 1 month ago

Thanks for the issue! Yeah, ?control_stack ought to send folks to the help-page that control_stack_grid() and other control functions share, but for some reason it doesn't seem like that setup worked effectively:

https://github.com/tidymodels/stacks/blob/6080a9ff571a47648b8f8edb6b075c9ea0473111/R/control.R#L20

Thanks.

re:

the help file has no example, nor description of inputs of the function, making it very hard to diagnostic the problem

There are no inputs to describe! The description might help with the diagnostic:

https://github.com/tidymodels/stacks/blob/6080a9ff571a47648b8f8edb6b075c9ea0473111/R/control.R#L3-L13

Maybe we can include a note in the examples that:

# these are the same
control_stack_grid()
control_grid(save_pred = TRUE, save_workflow = TRUE)
MatthieuStigler commented 1 month ago

I feel a lot of guessing is needed to infer from that help file that the problem is about save_pred = TRUE, save_workflow = TRUE... would it not be simpler to state this directly in the error message?

And yes, independent of the error message, a simple example like this would be helpful to understand what control_stack_grid does, and what it does not do (iei stacks::control_stack_grid(verbose=TRUE) won't work either).

Thanks!