recipes icon indicating copy to clipboard operation
recipes copied to clipboard

Proposal: Unification of stored objects in recipes

Open EmilHvitfeldt opened this issue 4 years ago • 2 comments

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.

EmilHvitfeldt avatar Sep 14 '21 20:09 EmilHvitfeldt

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.

DavisVaughan avatar Sep 14 '21 22:09 DavisVaughan

Even better!

EmilHvitfeldt avatar Sep 14 '21 22:09 EmilHvitfeldt