Internals Safely Make Predictions on a Fitted Workflow from Model Spec tibble
Source:R/internals-make-preds-wflw.R
internal_make_wflw_predictions.Rd
Safely Make predictions on 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_fitted_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.
Value
A list object tibble of the outcome variable and it's values along with the testing and training predictions in a single tibble.
.data_category | .data_type | .value |
actual | actual | 21.0 |
actual | actual | 21.0 |
actual | actual | 22.8 |
... | ... | ... |
predicted | training | 21.0 |
... | ... | ... |
predicted | training | 21.0 |
See also
Other Internals:
internal_make_fitted_wflw()
,
internal_make_spec_tbl()
,
internal_make_wflw()
,
internal_make_wflw_gee_lin_reg()
,
internal_set_args_to_tune()
,
make_classification_base_tbl()
,
make_regression_base_tbl()
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))
mod_fitted_tbl <- mod_tbl |>
mutate(fitted_wflw = internal_make_fitted_wflw(mod_tbl, splits_obj))
internal_make_wflw_predictions(mod_fitted_tbl, splits_obj)
#> [[1]]
#> # A tibble: 64 × 3
#> .data_category .data_type .value
#> <chr> <chr> <dbl>
#> 1 actual actual 21.4
#> 2 actual actual 15.2
#> 3 actual actual 30.4
#> 4 actual actual 22.8
#> 5 actual actual 15
#> 6 actual actual 14.7
#> 7 actual actual 32.4
#> 8 actual actual 19.2
#> 9 actual actual 21.5
#> 10 actual actual 18.1
#> # ℹ 54 more rows
#>
#> [[2]]
#> # A tibble: 64 × 3
#> .data_category .data_type .value
#> <chr> <chr> <dbl>
#> 1 actual actual 21.4
#> 2 actual actual 15.2
#> 3 actual actual 30.4
#> 4 actual actual 22.8
#> 5 actual actual 15
#> 6 actual actual 14.7
#> 7 actual actual 32.4
#> 8 actual actual 19.2
#> 9 actual actual 21.5
#> 10 actual actual 18.1
#> # ℹ 54 more rows
#>