tidymodels / TMwR

Code and content for "Tidy Modeling with R"
https://tmwr.org
Other
604 stars 285 forks source link

Error while render 10-resampling.Rmd #372

Closed davidrsch closed 1 year ago

davidrsch commented 1 year ago

The error is returned while running line 81:

estimate_perf(lm_fit, ames_train)

The error message returned is:

Warning: 'keep_original_cols' was added to `step_interact()` after this recipe was created.
Regenerate your recipe to avoid this warning.Warning: 'keep_original_cols' was added to `step_ns()` after this recipe was created.
Regenerate your recipe to avoid this warning.Error in `baked_data[processed_predictor_names]`:
! Can't subset columns that don't exist.
✖ Columns `Gr_Liv_Area`, `Bldg_Type_TwoFmCon`, `Bldg_Type_Duplex`, `Bldg_Type_Twnhs`, and `Bldg_Type_TwnhsE` don't exist.
Backtrace:
  1. model %>% predict(dat)
  3. workflows:::predict.workflow(., dat)
  4. workflows:::forge_predictors(new_data, workflow)
  6. hardhat:::forge.data.frame(new_data, blueprint = mold$blueprint)
  8. hardhat:::run_forge.default_recipe_blueprint(...)
  9. hardhat:::forge_recipe_default_process(...)
 11. tibble:::`[.tbl_df`(baked_data, processed_predictor_names)
EmilHvitfeldt commented 1 year ago

You are getting this because line 11 is loading in a object that was fit on an earlier version. For you, if you run these https://github.com/tidymodels/TMwR/blob/main/08-feature-engineering.Rmd#L560-L587 lines of code and omit line 11 in 10-resampling.Rmd you should be good

davidrsch commented 1 year ago

You're right, thanks.

github-actions[bot] commented 1 year ago

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.