Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message for missing assessment set rows at prediction time #307

Merged
merged 4 commits into from Oct 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions R/grid_helpers.R
Expand Up @@ -8,6 +8,26 @@ predict_model <- function(split, workflow, grid, metrics, submodels = NULL) {

orig_rows <- as.integer(split, data = "assessment")

if (length(orig_rows) != nrow(x_vals)) {
msg <- paste0("Some assessment set rows are not available at ",
"prediction time. ")

if (has_preprocessor_recipe(workflow)) {
msg <- paste0(
msg,
"Consider using `skip = TRUE` on any recipe steps that remove rows ",
"to avoid calling them on the assessment set."
)
} else {
msg <- paste0(
msg,
"Did your preprocessing steps filter or remove rows?"
)
}

rlang::abort(msg)
}

# Determine the type of prediction that is required
type_info <- metrics_info(metrics)
types <- unique(type_info$type)
Expand Down