broom.helpers icon indicating copy to clipboard operation
broom.helpers copied to clipboard

Improve output for workflows/parsnip objects estimated with tidymodels

Open ddsjoberg opened this issue 2 years ago • 6 comments

The tidymodels objects don't have the same 'terms' information in a standard model. But I do think all this information is stored in the object. Like I mentioned before, I am no tidymodels expert, but here I some tidbits I think are helpful for tackling this issue.

  1. workflows/parnsip models don't use model.frame() and model.matrix(). Rather they use model_frame() and model_matrix() that do not remove missing data from the return data frame/matrix.
  2. I think there is something similar for terms?
  3. I think parsnip has it's own tidiers? Not sure if it's full featured with all models supported? Not sure how workflows fall into this.
  4. Given a workflow object, there is a function to extract the parsnip fit. There is a followup function that you can use to extract the original model fit from there.
  5. tidymodels creates dummy variables from categorical variables. This could pose an issue identifying the underlying variable, and subsequently adding header rows.

I am not sure what the best way to add support for these objects, but I think it'll be a combination of updates to broom.helpers and gtsummary (passing a default tidier for these model types). I think this will be helpful to add, but to be honest, I am not sure I have the time right now. So we can just keep this open until one of us can get to it?

ddsjoberg avatar Jun 20 '22 00:06 ddsjoberg