tidymodels / recipes

Pipeable steps for feature engineering and data preprocessing to prepare for modeling
https://recipes.tidymodels.org
Other
564 stars 111 forks source link

Proposal: Unification of stored objects in recipes #799

Open EmilHvitfeldt opened 3 years ago

EmilHvitfeldt commented 3 years ago

I don't have a solution proposal to this one yet, so I'm just going to comment.

The trained steps have a named argument in their step to pass around the sufficient information that was trained during prep.*().

It would be nice if there was a consistently named argument in steps that were used to store this information across the steps.

step_pca() uses res, step_impute_linear() uses model.

DavisVaughan commented 3 years ago

Alternatively, we could formalize what is generally required in a step() and then anything else that is required for a particular method could go in $extras.

Like:

step <- function(class, id, ..., skip = FALSE, role = NA, trained = FALSE, extras = list()) {
  check_dots_empty() # dots are used to force named args only
}

I did have a tough experience today designing a step and forgetting exactly which of these fields are required, because they aren't in the step() constructor even though they are needed.

EmilHvitfeldt commented 3 years ago

Even better!