Extract a model fitted workflow from a tidyAML model tibble.
Details
This function allows you to get a model fitted workflow or more from
a tibble with a class of "tidyaml_mod_spec_tbl". It allows you to select the
model by the .model_id column. You can call the model id's by an integer
or a sequence of integers.
See also
Other Extractor:
extract_model_spec(),
extract_regression_residuals(),
extract_tunable_params(),
extract_wflw(),
extract_wflw_pred(),
get_model()
Examples
library(recipes)
rec_obj <- recipe(mpg ~ ., data = mtcars)
frt_tbl <- fast_regression(mtcars, rec_obj, .parsnip_eng = c("lm","glm"),
.parsnip_fns = "linear_reg")
extract_wflw_fit(frt_tbl, 1)
#> [[1]]
#> ══ Workflow [trained] ══════════════════════════════════════════════════════════
#> Preprocessor: Recipe
#> Model: linear_reg()
#>
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> 0 Recipe Steps
#>
#> ── Model ───────────────────────────────────────────────────────────────────────
#>
#> Call:
#> stats::lm(formula = ..y ~ ., data = data)
#>
#> Coefficients:
#> (Intercept) cyl disp hp drat wt
#> 18.15559 -0.55442 0.03200 -0.03765 -0.67125 -5.90849
#> qsec vs am gear carb
#> 0.96997 0.58619 1.97247 1.10145 0.63792
#>
#>
extract_wflw_fit(frt_tbl, 1:2)
#> [[1]]
#> ══ Workflow [trained] ══════════════════════════════════════════════════════════
#> Preprocessor: Recipe
#> Model: linear_reg()
#>
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> 0 Recipe Steps
#>
#> ── Model ───────────────────────────────────────────────────────────────────────
#>
#> Call:
#> stats::lm(formula = ..y ~ ., data = data)
#>
#> Coefficients:
#> (Intercept) cyl disp hp drat wt
#> 18.15559 -0.55442 0.03200 -0.03765 -0.67125 -5.90849
#> qsec vs am gear carb
#> 0.96997 0.58619 1.97247 1.10145 0.63792
#>
#>
#> [[2]]
#> ══ Workflow [trained] ══════════════════════════════════════════════════════════
#> Preprocessor: Recipe
#> Model: linear_reg()
#>
#> ── Preprocessor ────────────────────────────────────────────────────────────────
#> 0 Recipe Steps
#>
#> ── Model ───────────────────────────────────────────────────────────────────────
#>
#> Call: stats::glm(formula = ..y ~ ., family = stats::gaussian, data = data)
#>
#> Coefficients:
#> (Intercept) cyl disp hp drat wt
#> 18.15559 -0.55442 0.03200 -0.03765 -0.67125 -5.90849
#> qsec vs am gear carb
#> 0.96997 0.58619 1.97247 1.10145 0.63792
#>
#> Degrees of Freedom: 23 Total (i.e. Null); 13 Residual
#> Null Deviance: 713
#> Residual Deviance: 79.02 AIC: 120.7
#>
