
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.
See also
Other Internals:
internal_make_spec_tbl()
,
internal_make_wflw_predictions()
,
internal_make_wflw()
,
internal_set_args_to_tune()
,
make_classification_base_tbl()
,
make_regression_base_tbl()
Examples
library(recipes, quietly = TRUE)
library(dplyr, quietly = TRUE)
mod_spec_tbl <- fast_regression_parsnip_spec_tbl(
.parsnip_eng = c("lm","glm","gee"),
.parsnip_fns = "linear_reg"
)
rec_obj <- recipe(mpg ~ ., data = mtcars)
splits_obj <- create_splits(mtcars, "initial_split")
mod_tbl <- mod_spec_tbl %>%
mutate(wflw = internal_make_wflw(mod_spec_tbl, rec_obj))
#> Error in `.f()`:
#> ! parsnip could not locate an implementation for `linear_reg` regression
#> model specifications using the `gee` engine.
#> ℹ The parsnip extension package multilevelmod implements support for this
#> specification.
#> ℹ Please install (if needed) and load to continue.
internal_make_fitted_wflw(mod_tbl, splits_obj)
#> Error in UseMethod("fit"): no applicable method for 'fit' applied to an object of class "NULL"
#> [[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
#> 20.51393 -0.46041 0.01678 -0.01923 -0.37071 -3.86832
#> qsec vs am gear carb
#> 0.68223 1.15641 2.92763 0.47227 -0.16589
#>
#>
#> [[2]]
#> NULL
#>
#> [[3]]
#> ══ 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
#> 20.51393 -0.46041 0.01678 -0.01923 -0.37071 -3.86832
#> qsec vs am gear carb
#> 0.68223 1.15641 2.92763 0.47227 -0.16589
#>
#> Degrees of Freedom: 23 Total (i.e. Null); 13 Residual
#> Null Deviance: 861.4
#> Residual Deviance: 101.2 AIC: 126.7
#>