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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass calls through forge_predictors() #279

Open
EmilHvitfeldt opened this issue Jan 10, 2025 · 1 comment
Open

pass calls through forge_predictors() #279

EmilHvitfeldt opened this issue Jan 10, 2025 · 1 comment
Labels
upkeep maintenance, infrastructure, and similar

Comments

@EmilHvitfeldt
Copy link
Member

Reprex:

library(workflows)
library(parsnip)
library(recipes)

rec_spec <-
  recipe(mpg ~ ., data = mtcars) %>%
  update_role(disp, new_role = "date") %>%
  step_center(disp)

lm_spec <- linear_reg()

wf_spec <- workflow(rec_spec, lm_spec)

wf_fit <- fit(wf_spec, data = mtcars)

predict(wf_fit, mtcars %>% select(-disp))
#> Error in `hardhat::forge()`:
#> ! The required column "disp" is missing.
@EmilHvitfeldt EmilHvitfeldt added the upkeep maintenance, infrastructure, and similar label Jan 10, 2025
@EmilHvitfeldt
Copy link
Member Author

without spending too much time right now, i suppect it might be somewhere in {hardhat} that is the issue. Here is the traceback

1. ├─stats::predict(wf_fit, mtcars %>% select(-disp))
  2. └─workflows:::predict.workflow(wf_fit, mtcars %>% select(-disp))
  3.   └─workflows:::forge_predictors(new_data, workflow)
  4.     ├─hardhat::forge(new_data, blueprint = mold$blueprint)
  5.     └─hardhat:::forge.data.frame(new_data, blueprint = mold$blueprint)
  6.       ├─hardhat::run_forge(blueprint, new_data = new_data, outcomes = outcomes)
  7.       └─hardhat:::run_forge.default_recipe_blueprint(...)
  8.         └─hardhat:::forge_recipe_default_clean(...)
  9.           └─hardhat:::forge_recipe_default_clean_extras(...)
 10.             └─hardhat:::map(...)
 11.               └─base::lapply(.x, .f, ...)
 12.                 └─hardhat (local) FUN(X[[i]], ...)
 13.                   └─hardhat::validate_column_names(data, cols, call = call)
 14.                     └─cli::cli_abort(...)
 15.                       └─rlang::abort(...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upkeep maintenance, infrastructure, and similar
Projects
None yet
Development

No branches or pull requests

1 participant