Commit c54f07b
authored
improve prompting about missing implementations (#793)
* move missing extension prompt from `new_model_spec` to `print_model_spec`
also, deprecates `check_missing_spec` argument
* tighten logic for no-engines-in-parsnip case
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')`.
```
* tighten logic with modes, transition prompts from `rlang` -> `cli`
* prompt on missing implementation in `fit`
also:
* fixes duplicated packages in prompt
* appends a newline regardless of whether a specific extension is recommended
* allows passing additional arguments to `prompt`
* update snapshots + tests
mostly undoing changes made for 732.
* add tests
still need to test interactions with extensions--this will have to live in extratests
* re`document`
* use `cli` formatting for `.pkg`s
* integrate `default` attributes for engine and mode
* migrate arg attributes to new model spec slots
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.
* test fixes + updates, swimming in edge case spaghetti
* re`document()` with new `new_model_spec()` args
* address some review comments
* 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
* address remainder of review comments
* comment on checking strategy
* name arguments to `prompt_missing_implementation`
* mark parsnip with `.pkg` cli tag
* export and document model spec checking functions
also, renames `has_loaded_implementation` -> `spec_is_loaded`1 parent fdde60a commit c54f07b
File tree
47 files changed
+523
-122
lines changed- R
- man
- tests/testthat
- _snaps
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
47 files changed
+523
-122
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
| |||
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
| 275 | + | |
| 276 | + | |
274 | 277 | | |
275 | 278 | | |
276 | 279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
40 | 49 | | |
41 | 50 | | |
42 | 51 | | |
| |||
220 | 229 | | |
221 | 230 | | |
222 | 231 | | |
223 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
224 | 240 | | |
225 | 241 | | |
226 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
100 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
101 | 111 | | |
| 112 | + | |
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | | - | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | | - | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
88 | 89 | | |
89 | | - | |
| 90 | + | |
| 91 | + | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
78 | 79 | | |
79 | | - | |
| 80 | + | |
| 81 | + | |
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | | - | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | | - | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | | - | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
0 commit comments