Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

axe_data does not remove pre$mold$extras #205

Open
era127 opened this issue Jun 29, 2023 · 3 comments
Open

axe_data does not remove pre$mold$extras #205

era127 opened this issue Jun 29, 2023 · 3 comments
Labels
feature a feature request or enhancement

Comments

@era127
Copy link

era127 commented Jun 29, 2023

The axe_data.workflow() function does not remove the mold$extras like it does for outcomes and predictors. If a column of data is set to be another role, the model will retain all of that data. Would it be OK to also remove pre$mold$extras or was it intentionally retained for predictions?

The 'outcomes' and 'predictors' are removed here.

axe_data.workflow <- function(x, verbose = FALSE, ...) {
  fit <- extract_fit_parsnip(x)
  fit <- butcher::axe_data(fit, verbose = verbose, ...)
  x <- replace_workflow_fit(x, fit)

  x <- replace_workflow_outcomes(x, NULL)
  x <- replace_workflow_predictors(x, NULL)

  add_butcher_class(x)
}
@EmilHvitfeldt EmilHvitfeldt added the feature a feature request or enhancement label Jun 30, 2023
@EmilHvitfeldt
Copy link
Member

Removing extras makes sense to me.

according to ?axe_data.workflow it reads:

After calling butcher::butcher() on a workflow, the only guarantee is that you will still be able to predict() from that workflow

And I don't see $pre$mold$extras being used for prediction right now

@era127
Copy link
Author

era127 commented Jul 1, 2023

Would the code change be similar to the others and add a new function call to set $extras to NULL:

  x <- replace_workflow_extras(x, NULL)

or would we want to preserve $extras$offset, $extras$id or extras$case_weights. I'm not sure I fully understand the use of those roles.

@EmilHvitfeldt
Copy link
Member

@simonpcouch should be able to confirm. But I'm pretty sure we don't need them for prediction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants