Skip to content

Commit

Permalink
require optional arguments to be named (#151)
Browse files Browse the repository at this point in the history
* move ellipses in `collect_*()` functions
* add NEWS entry
  • Loading branch information
simonpcouch authored Mar 11, 2024
1 parent 5e8e460 commit 319c1e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# workflowsets (development version)

* Ellipses (...) are now used consistently in the package to require optional arguments to be named; `collect_metrics()` and `collect_predictions()` are the only functions that received changes (#151, tidymodels/tune#863).
* Enabled evaluating censored regression models (#139, #144). The placement of
the new `eval_time` argument to `rank_results()` breaks passing-by-position
for the `select_best` argument.
Expand Down
10 changes: 6 additions & 4 deletions R/collect.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#'
#' @param x A [`workflow_set`][workflow_set()] object that has been evaluated
#' with [workflow_map()].
#' @param ... Not currently used.
#' @param summarize A logical for whether the performance estimates should be
#' summarized via the mean (over resamples) or the raw performance values (per
#' resample) should be returned along with the resampling identifiers. When
Expand All @@ -17,7 +18,6 @@
#' are retained. If `TRUE`, the `parameters` argument is ignored.
#' @param metric A character string for the metric that is used for
#' `select_best`.
#' @param ... Not currently used.
#' @return A tibble.
#' @details
#'
Expand Down Expand Up @@ -57,7 +57,8 @@
#'
#' collect_metrics(two_class_res, summarize = FALSE)
#' @export
collect_metrics.workflow_set <- function(x, summarize = TRUE, ...) {
collect_metrics.workflow_set <- function(x, ..., summarize = TRUE) {
rlang::check_dots_empty()
check_incompete(x, fail = TRUE)
check_bool(summarize)
x <-
Expand Down Expand Up @@ -98,8 +99,9 @@ reorder_cols <- function(x) {
#' @export
#' @rdname collect_metrics.workflow_set
collect_predictions.workflow_set <-
function(x, summarize = TRUE, parameters = NULL, select_best = FALSE,
metric = NULL, ...) {
function(x, ..., summarize = TRUE, parameters = NULL, select_best = FALSE,
metric = NULL) {
rlang::check_dots_empty()
check_incompete(x, fail = TRUE)
check_bool(summarize)
check_bool(select_best)
Expand Down
10 changes: 5 additions & 5 deletions man/collect_metrics.workflow_set.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 319c1e8

Please sign in to comment.