These functions extract various elements from a workflow set object. If they do not exist yet, an error is thrown.

  • extract_preprocessor() returns the formula, recipe, or variable expressions used for preprocessing.

  • extract_spec_parsnip() returns the parsnip model specification.

  • extract_fit_parsnip() returns the parsnip model fit object.

  • extract_fit_engine() returns the engine specific fit embedded within a parsnip model fit. For example, when using parsnip::linear_reg() with the "lm" engine, this returns the underlying lm object.

  • extract_mold() returns the preprocessed "mold" object returned from hardhat::mold(). It contains information about the preprocessing, including either the prepped recipe, the formula terms object, or variable selectors.

  • extract_recipe() returns the recipe. The estimated argument specifies whether the fitted or original recipe is returned.

  • extract_workflow_set_result() returns the results of workflow_map() for a particular workflow.

  • extract_workflow() returns the workflow object. The workflow will not have been estimated.

extract_workflow_set_result(x, id, ...)

# S3 method for workflow_set
extract_workflow(x, id, ...)

# S3 method for workflow_set
extract_spec_parsnip(x, id, ...)

# S3 method for workflow_set
extract_recipe(x, id, ..., estimated = TRUE)

# S3 method for workflow_set
extract_fit_parsnip(x, id, ...)

# S3 method for workflow_set
extract_fit_engine(x, id, ...)

# S3 method for workflow_set
extract_mold(x, id, ...)

# S3 method for workflow_set
extract_preprocessor(x, id, ...)

Arguments

x

A workflow set.

id

A single character string for a workflow ID.

...

Other options (not currently used).

estimated

A logical for whether the original (unfit) recipe or the fitted recipe should be returned.

Value

The extracted value from the object, x, as described in the description section.

Details

These functions supersede the pull_*() functions (e.g., extract_workflow_set_result()).

Examples

library(tune) extract_workflow_set_result(two_class_res, "none_cart")
#> # Tuning results #> # 5-fold cross-validation #> # A tibble: 5 x 4 #> splits id .metrics .notes #> <list> <chr> <list> <list> #> 1 <split [632/159]> Fold1 <tibble [20 × 6]> <tibble [0 × 1]> #> 2 <split [633/158]> Fold2 <tibble [20 × 6]> <tibble [0 × 1]> #> 3 <split [633/158]> Fold3 <tibble [20 × 6]> <tibble [0 × 1]> #> 4 <split [633/158]> Fold4 <tibble [20 × 6]> <tibble [0 × 1]> #> 5 <split [633/158]> Fold5 <tibble [20 × 6]> <tibble [0 × 1]>
extract_workflow(two_class_res, "none_cart")
#> ══ Workflow ════════════════════════════════════════════════════════════════════ #> Preprocessor: Formula #> Model: decision_tree() #> #> ── Preprocessor ──────────────────────────────────────────────────────────────── #> Class ~ A + B #> #> ── Model ─────────────────────────────────────────────────────────────────────── #> Decision Tree Model Specification (classification) #> #> Main Arguments: #> cost_complexity = tune() #> min_n = tune() #> #> Computational engine: rpart #>