-
Notifications
You must be signed in to change notification settings - Fork 93
function to get prediction columns #1224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
res$probabilities <- ".pred" | ||
} | ||
} else { | ||
cli::cli_abort("Unsupported model mode {model_mode}.") |
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 don't know that this branch of the if/then will ever be encountered, given the error check above. However, we might hit is when we have a mode for quantile regression data so I'd err on the side of leaving it in, untested.
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 think that is reasonable
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.
looking good. very clean
Co-authored-by: Emil Hvitfeldt <emil.hvitfeldt@posit.co>
#' | ||
#' .get_prediction_column_names(lr_fit) | ||
#' .get_prediction_column_names(lr_fit, syms = TRUE) | ||
#' @export |
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.
Could we make this function @keyword internal
?
if (inherits(x, "workflow")) { | ||
x <- x %>% extract_fit_parsnip(x) | ||
} |
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.
With an eye toward the release cascade and trying to keep things as modular as possible, I think it would be good to make this function only for model_spec
objects. This call to extract_fit_parsnip()
seems to be all that's necessary for workflow objects. I'd move that to workflows or wherever this is going to be needed.
if (length(predict_types) == 0) { | ||
cli::cli_abort("Prediction information could not be found for this | ||
{.fn {model_type}} with engine {.val {model_engine}} and mode | ||
{.val {model_mode}}. Does a parsnip extension package need to |
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.
That last question would be very nice in an i
bullet rather than the error message itself.
) | ||
|
||
unk_fit <- ols_fit | ||
unk_fit$spec$mode <- "Depeche" |
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.
😆
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
In service of tidymodels/workflows#273
For a fitted model or workflow, return the column names that will contain predictions for the main types given by
augment()
.Tests for censored regression models and workflows will be in extratests