select_best() requires named argument metric after installing tidymodels 1.2.0

After upgrading to tidymodels 1.2.0 from 1.1.1 the command select_best() requires a named argument for metric, which breaks older code.

select_best(MyTunedWorkflow, "rmse") used to work but does not work anymore.
select_best(MyTunedWorkflow, metric="rmse") is required in 1.2.0

Is there a chance this will be fixed in an update?

Thank you.

Carsten

This sounds like a question that would best asked here:

Hello @carstenlange :wave:

This is a documented breaking change in tune 1.2.0 Changelog • tune

  • Ellipses (…) are now used consistently in the package to require optional arguments to be named. For functions that previously had ellipses at the end of the function signature, they have been moved to follow the last argument without a default value: this applies to augment.tune_results(), collect_predictions.tune_results(), collect_metrics.tune_results(), select_best.tune_results(), show_best.tune_results(), and the developer-focused estimate_tune_results(), load_pkgs(), and encode_set(). Several other functions that previously did not have ellipses in their signatures gained them: this applies to conf_mat_resampled() and the developer-focused check_workflow(). Optional arguments previously passed by position will now error informatively prompting them to be named. These changes don’t apply in cases when the ellipses are currently in use to forward arguments to other functions (#863).

This is done in an effort to avoid silent bugs that happens when people accidentally misspell argument names, and to improve consistency in function interface across tidymodels. By having optional argument be specified by name.

1 Like

Thank you Emil for your reply. This helps as I know now my course of action is to update my code. Best, Carsten

Good luck for Denmark in the Euro 2024.

This topic was automatically closed 90 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.