-
Notifications
You must be signed in to change notification settings - Fork 42
Add outcome_names() method for workflows using add_variables() #994
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing some of the context in which this is (going to be) called, so I got two questions :D
|
||
#' @export | ||
#' @rdname outcome_names | ||
outcome_names.tune_results <- function(x, ..., call = caller_env()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this change in function signature for tune_results
objects? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're welcome to suggest a change.
cli::cli_abort( | ||
"To determine the outcome names when {.fn add_variables} is used, please | ||
pass the training set data to the {.arg data} argument.", | ||
call = call | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an error message for the user or for us?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, digging around a bit more here and I think there is a little messaging mismatch to resolve in that error message:
Do you mean that the user of outcome_names()
should use the data
argument of outcome_names()
? The user of outcome_names()
is presumably just us since outcome_names()
is labeled with @keywords internal
. In that case, I wouldn't pass in the call to cli_abort()
and possibly remove the reference to add_variables()
. The context of how we got into this probably lives better elsewhere, likely wherever we call it from and need to add data
, so in tune_grid()
or int_pctl()
.
If you mean the general tidymodels user the current error message is probably confusing: they only call tune_grid()
or int_pctl()
and couldn't use that data
argument to outcome_names()
. tune_grid()
does not have a data
argument and int_pctl()
has .data
but that is not the same as the data
for outcome_name()
. (And imagining a very desperate user, looking into the mentioned add_variables()
also does not reveal a data
argument.)
I'm guessing path 1 is the right one here?
|
||
#' @export | ||
#' @rdname outcome_names | ||
outcome_names.tune_results <- function(x, ..., call = caller_env()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outcome_names.tune_results <- function(x, ..., call = caller_env()) { | |
outcome_names.tune_results <- function(x, ...) { |
I don't think the addition is necessary (and tests pass without it) so I'd just leave things as is.
cli::cli_abort( | ||
"To determine the outcome names when {.fn add_variables} is used, please | ||
pass the training set data to the {.arg data} argument.", | ||
call = call | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, digging around a bit more here and I think there is a little messaging mismatch to resolve in that error message:
Do you mean that the user of outcome_names()
should use the data
argument of outcome_names()
? The user of outcome_names()
is presumably just us since outcome_names()
is labeled with @keywords internal
. In that case, I wouldn't pass in the call to cli_abort()
and possibly remove the reference to add_variables()
. The context of how we got into this probably lives better elsewhere, likely wherever we call it from and need to add data
, so in tune_grid()
or int_pctl()
.
If you mean the general tidymodels user the current error message is probably confusing: they only call tune_grid()
or int_pctl()
and couldn't use that data
argument to outcome_names()
. tune_grid()
does not have a data
argument and int_pctl()
has .data
but that is not the same as the data
for outcome_name()
. (And imagining a very desperate user, looking into the mentioned add_variables()
also does not reveal a data
argument.)
I'm guessing path 1 is the right one here?
Closes #993