tidymodels / hardhat

Construct Modeling Packages
https://hardhat.tidymodels.org
Other
101 stars 16 forks source link

Could `forge()` only preprocess predictors, and have a separate function for outcomes? #91

Closed DavisVaughan closed 5 years ago

DavisVaughan commented 5 years ago

After implementing residuals.logistic_regression, it looks like I have to call both predict() (which uses forge() without asking for outcomes) to get the fitted values, and forge(outcomes = TRUE) separately to preprocess and retrieve the outcomes. Both of these are required to compute residuals, but this ends up preprocessing the predictors twice.

With recipes I think this is unavoidable, but I wonder if there is room for another function that only preprocesses outcomes? Then we would remove outcomes from forge() as an argument.

Would this be too much since it would only really help the formula method?

DavisVaughan commented 5 years ago

I suppose I could have just written a lower level predict function that also has the option to return the outcomes if they are available, and that would pass that on to forge(outcomes = TRUE). The top level predict() would always have that internally set to outcomes = FALSE

So you have the possibility to get a tibble back from this lower level predict function with columns of .pred_0, .pred_1, .outcome so that you dont have to call both predict() and forge() in residuals()

github-actions[bot] commented 3 years 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.