-
Notifications
You must be signed in to change notification settings - Fork 25
Closed as not planned
Description
Related to tidymodels/parsnip#793: add_model() is another step where we can be confident a user has "finished" defining their model spec, and we can warn or error then if a user hasn't loaded the needed parsnip extension package.
# note: do not load required parsnip extension
library(parsnip)
library(workflows)
bt_mod <- bag_tree() %>%
set_engine("rpart") %>%
set_mode("regression")
bt_wf <- workflow() %>%
add_model(bt_mod) %>%
add_formula(mpg ~ .)
fit(bt_wf, data = mtcars)
#> Error in if (nrow(out) != 1L) {: argument is of length zero
# works fine with baguette loaded
library(baguette)
fit(bt_wf, data = mtcars)
#> ══ Workflow [trained] ══════════════════════════════════════════════════════════
#> Preprocessor: Formula
#> Model: bag_tree()
#>
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> mpg ~ .
#>
#> ── Model ───────────────────────────────────────────────────────────────────────
#> Bagged CART (regression with 11 members)
#>
#> Variable importance scores include:
#>
#> # A tibble: 10 × 4
#> term value std.error used
#> <chr> <dbl> <dbl> <int>
#> 1 wt 849. 95.5 11
#> 2 hp 843. 82.4 11
#> 3 disp 840. 79.4 11
#> 4 drat 480. 90.5 11
#> 5 cyl 459. 56.3 11
#> 6 qsec 220. 46.4 11
#> 7 am 70.1 40.3 9
#> 8 gear 60.7 29.4 7
#> 9 vs 60.0 23.3 10
#> 10 carb 51.6 18.2 11Created on 2022-09-08 by the reprex package (v2.0.1)
Metadata
Metadata
Assignees
Labels
No labels