-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior
Description
The documentation for repair_call() says that x should be "A fitted parsnip model." But if you didn't see that (like I did) it produces errors when applied to non-parsnip fits.
I have two thoughts
- Have
repair_call()explicitly check ifxis of classmodel_fitand error accordingly. - Expand the use of
repair_call()to work with workflow objects, and possibly the raw engine fit.
Right now it is a little awkward because you need to call two extract_fit_*() functions
wf_fit %>%
extract_fit_parsnip() %>%
repair_call(mtcars) %>%
extract_fit_engine()library(tidymodels)
lm_spec <- linear_reg() %>%
set_mode("regression") %>%
set_engine("lm")
lm_wf <- workflow() %>%
add_formula(mpg ~ .) %>%
add_model(lm_spec)
wf_fit <- fit(lm_wf, data = mtcars)
parsnip_fit <- extract_fit_parsnip(wf_fit)
engine_fit <- extract_fit_engine(wf_fit)
repair_call(parsnip_fit, mtcars)
#> parsnip model object
#>
#> Fit time: 4ms
#>
#> Call:
#> stats::lm(formula = ..y ~ ., data = mtcars)
#>
#> Coefficients:
#> (Intercept) cyl disp hp drat wt
#> 12.30337 -0.11144 0.01334 -0.02148 0.78711 -3.71530
#> qsec vs am gear carb
#> 0.82104 0.31776 2.52023 0.65541 -0.19942
repair_call(wf_fit, mtcars)
#> Error: No `call` object to modify.
repair_call(engine_fit, mtcars)
#> Error: No `call` object to modify.Created on 2021-11-12 by the reprex package (v2.0.1)
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior