
Internals Safely Make a Fitted Workflow from Model Spec tibble
Source:R/internals-make-fitted-wflw.R
internal_make_fitted_wflw.Rd
Safely Make a fitted workflow from a model spec tibble.
Arguments
- .model_tbl
The model table that is generated from a function like
fast_regression_parsnip_spec_tbl()
, must have a class of "tidyaml_mod_spec_tbl". This is meant to be used after the functioninternal_make_wflw()
has been run and the tibble has been saved.- .splits_obj
The splits object from the auto_ml function. It is internal to the
auto_ml_
function.
Examples
library(recipes, quietly = TRUE)
mod_spec_tbl <- fast_regression_parsnip_spec_tbl(
.parsnip_eng = c("lm","glm"),
.parsnip_fns = "linear_reg"
)
rec_obj <- recipe(mpg ~ ., data = mtcars)
splits_obj <- create_splits(mtcars, "initial_split")
mod_tbl <- mod_spec_tbl |>
mutate(wflw = full_internal_make_wflw(mod_spec_tbl, rec_obj))
internal_make_fitted_wflw(mod_tbl, splits_obj)
#> [[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
#> -35.101187 0.668269 0.014342 0.003826 3.535597 -4.892274
#> qsec vs am gear carb
#> 2.908092 -3.705634 3.574713 -0.332111 -0.250442
#>
#>
#> [[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
#> -35.101187 0.668269 0.014342 0.003826 3.535597 -4.892274
#> qsec vs am gear carb
#> 2.908092 -3.705634 3.574713 -0.332111 -0.250442
#>
#> Degrees of Freedom: 23 Total (i.e. Null); 13 Residual
#> Null Deviance: 790.2
#> Residual Deviance: 69.29 AIC: 117.6
#>