-
Notifications
You must be signed in to change notification settings - Fork 92
improve prompting about missing implementations #793
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
Conversation
…pec` also, deprecates `check_missing_spec` argument
this code used to miss the edge case where a non-relevant extension package was loaded. e.g.: ``` bag_tree() %>% set_engine("C5.0") #> parsnip could not locate an implementation for `bag_tree` model specifications #> using the `C5.0` engine. #> Bagged Decision Tree Model Specification (unknown) #> #> Main Arguments: #> cost_complexity = 0 #> min_n = 2 #> #> Computational engine: C5.0 library(censored) bag_tree() %>% set_engine("C5.0") #> Error in `check_spec_mode_engine_val()`: #> ! Engine 'C5.0' is not supported for `bag_tree()`. See `show_engines('bag_tree')`. ```
also: * fixes duplicated packages in prompt * appends a newline regardless of whether a specific extension is recommended * allows passing additional arguments to `prompt`
mostly undoing changes made for 732.
e.g. `attr(model_spec$mode, "default")` now lives at `model_spec$user_specified_mode`. a likely _less_ breaking change and lives more visibly in the object structure.
Note: this community post points out additional locations where we might want to drop these checks, none of which live in parsnip— |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll run this with TMwR and our workshop notes to test more.
Can you run revdeps?
@@ -37,8 +37,10 @@ bag_mars <- | |||
args = args, | |||
eng_args = NULL, | |||
mode = mode, | |||
user_specified_mode = !missing(mode), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes will have to propagate to the external extension packages too (e.g. model time)?
We'll also need to update the docs on tidymodels.org too (I believe).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
engine_filter_condition
and mode_filter_condition
(to be renamed re: comment), where these slots are processed, anticipate model objects from external extension packages not having this slot—in those cases, we bypass the additional prompts so that those external extensions fall back to the same errors as before. Those extensions can add the slot and get the prompting introduced in this PR "for free," since these prompts look to a full join of the model environment and model_info_table
.
Good thought on the tidymodels.org docs. Will follow-up with a PR there.
Thanks for the review! Running revdeps and addressing comments ATM. |
No new problems in revdeps, though I found a backward-compatibility issue that wasn't caught. |
* transition `model_info_table` read to a helper * `implementation_exists_somewhere` -> `spec_is_possible` * comment on `*_filter_condition` helpers * minimal testing for old/external objects
* comment on checking strategy * name arguments to `prompt_missing_implementation` * mark parsnip with `.pkg` cli tag
also, renames `has_loaded_implementation` -> `spec_is_loaded`
The most recent commit exports and documents the relationship between the different checking functions more thoroughly:
|
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. |
Follows up on #732 and #778. The goal here is to tighten the logic for prompts about missing implementations. This PR eliminates false positives and makes sure we always suggest "registered" extension packages when they could be relevant.
To do so, we defer model specification checking for type / engine / mode combinations until we have some sort of clue that the user might be "done" specifying the model (If only we could
<-.model_spec
😭). This is at:print
fit
...and functions that use either downstream. Some examples of how these prompts used to be raised:
Created on 2022-08-17 by the reprex package (v2.0.1)
Same code with the dev version:
Created on 2022-08-30 by the reprex package (v2.0.1)
This also catches bugs related to how loading one unrelated extension would affect the prompts related to another. PR to extratests to make sure we test this here! There are also additional tests with decision trees there.
On
fit()
, this same message is elevated to an error.Open to ideas if we have any other cues that a user may be "done" putting together a model spec—adding to a workflow is another instance, though we'll get "automatic" workflow support otherwise in that it wraps parsnip's print and fit methods. Same with parameter extraction.