Hi folks,
It looks like the predict method for workflow objects (workflows:::predict.workflows) seems to remove the outcome variables in hardhat::forge, and thus causes an error if a recipe has a pre-processing step that involves the outcome variables.
I'm cross-posting this to hardhat since I think the issue may be in the way variables are passed inside of hardhat:::forge.data.frame.
hardhat::forge is not passed outcomespredict.R#L59 and thus hardhat:::forge.data.frame has outcomes as false. When blueprint$forge$clean method is called , outcome is returned as NULL even though the blueprint$recipe$term_info object still has the outcome variable indicated.
When blueprint$forge$process is called and new_data is transformed using
hardhat::blueprint-recipe-default.R#L341new_data no longer contains the outcome variable. A few steps later when new_data reaches the bake step, if the recipe involves pre-processing ofoutcome variables, the following error is thrown:
Error: Can't subset columns that don't exist.
That's the extent of what I can make of it from debugging.
This issue 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.
Crosspost from workflows#60
Hi folks, It looks like the
predict
method forworkflow
objects (workflows:::predict.workflows
) seems to remove the outcome variables inhardhat::forge
, and thus causes an error if a recipe has a pre-processing step that involves the outcome variables. I'm cross-posting this tohardhat
since I think the issue may be in the way variables are passed inside ofhardhat:::forge.data.frame
.Here's a reprex:
Here's the stack trace.
hardhat::forge
is not passedoutcomes
predict.R#L59 and thushardhat:::forge.data.frame
hasoutcomes
as false. Whenblueprint$forge$clean
method is called ,outcome
is returned asNULL
even though theblueprint$recipe$term_info
object still has theoutcome
variable indicated. Whenblueprint$forge$process
is called andnew_data
is transformed usinghardhat::blueprint-recipe-default.R#L341
new_data
no longer contains the outcome variable. A few steps later whennew_data
reaches thebake
step, if the recipe involves pre-processing ofoutcome
variables, the following error is thrown:Error: Can't subset columns that don't exist.
That's the extent of what I can make of it from debugging.
Hope it's an easy fix!
sessionInfo: