cmu-delphi / epipredict

Tools for building predictive models in epidemiology.
https://cmu-delphi.github.io/epipredict/
Other
9 stars 9 forks source link

Steps sometimes destroy the `epi_df` #376

Closed dajmcdon closed 1 month ago

dajmcdon commented 1 month ago

Consider reconstructing the epi_df after each step inside the bake/prep loop.

dsweber2 commented 1 month ago

I was running into this in adjustAhead with step_mutate; I think most non-epipredict steps will do this.

My solution for this was to put the metadata in at prep time, but that isn't exactly ideal, as there may be different metadata at later points

dajmcdon commented 1 month ago

This is potentially impossible to fix. Any call to bake() will destroy the epi_df at the end of the loop (unless we clobber recipes:::bake.recipe().

Reason:

bake(epi_recipe) -> recipes:::bake.recipe() -> ... -> hardhat::recompose(new_data,...) -> hardhat::coerce_to_tibble() -> hardhat::hardhat_new_tibble()

This last drops the class without recourse. I don't suspect they will be willing to change this behaviour: tidymodels/hardhat#230.