Skip to content

Conversation

@hfrick
Copy link
Member

@hfrick hfrick commented Nov 21, 2022

prepare_data() is called within the predict_<prediction type>().model_fit() methods, on the model_fit and the new_data. If we converted the training data between different interfaces (matrix vs formula), we also convert the new_data at prediction time, via .convert_form_to_xy_new() and .convert_xy_to_form_new() respectively. Whether those get called is determined based on the objects in the $preproc of the fitted parsnip model.

I've refactored this here to use variable names for the conditions, to make it easier to understand which preproc items are linked to which conversion.

The main question for review is: is it okay to rely only on the names of the preproc items? The previous version relied on them to decide if any .convert_*() function should be applied. The refactored version also relies on them to decide which of them should be applied.

@hfrick hfrick requested a review from topepo November 21, 2022 19:46
@topepo topepo merged commit dea8445 into main Nov 29, 2022
@topepo topepo deleted the refactor-prepare-data branch November 29, 2022 19:31
@github-actions
Copy link
Contributor

This pull request 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.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants