
Extract one workflow of a workflow-set run
Source:R/nested-results-set.R
extract_workflow.nested_results_set.Rdextract_workflow() returns the workflow a set holds under one
wflow_id, as it was given, with nothing fitted or finalized.
Usage
# S3 method for class 'nested_results_set'
extract_workflow(x, id, ...)Arguments
- x
A
nested_results_setfromnested_workflow_map().- id
The
wflow_idof the workflow to return, one ofx$wflow_id.- ...
Not used, and must be empty.
Examples
data(mtcars)
rec <- recipes::recipe(mpg ~ ., data = mtcars) |>
recipes::step_pca(recipes::all_predictors(), num_comp = tune::tune())
wf <- workflows::workflow(rec, parsnip::linear_reg())
set.seed(1)
folds <- nested_resamples(
mtcars,
outside = rsample::vfold_cv(v = 2),
inside = rsample::vfold_cv(v = 2)
)
# One tuned workflow and one baseline, on the same nested design.
wset <- workflowsets::workflow_set(
preproc = list(pca = rec, none = recipes::recipe(mpg ~ ., data = mtcars)),
models = list(lm = parsnip::linear_reg())
)
set.seed(2)
res <- nested_workflow_map(wset, resamples = folds, grid = data.frame(num_comp = 1:2))
extract_workflow(res, "none_lm")
#> ══ Workflow ═══════════════════════════════════════════════════════════
#> Preprocessor: Recipe
#> Model: linear_reg()
#>
#> ── Preprocessor ───────────────────────────────────────────────────────
#> 0 Recipe Steps
#>
#> ── Model ──────────────────────────────────────────────────────────────
#> Linear Regression Model Specification (regression)
#>
#> Computational engine: lm
#>