extract_workflow_set_result {workflowsets} | R Documentation |
Extract elements of workflow sets
Description
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 usingparsnip::linear_reg()
with the"lm"
engine, this returns the underlyinglm
object. -
extract_mold()
returns the preprocessed "mold" object returned fromhardhat::mold()
. It contains information about the preprocessing, including either the prepped recipe, the formula terms object, or variable selectors. -
extract_recipe()
returns the recipe. Theestimated
argument specifies whether the fitted or original recipe is returned. -
extract_workflow_set_result()
returns the results ofworkflow_map()
for a particular workflow. -
extract_workflow()
returns the workflow object. The workflow will not have been estimated. -
extract_parameter_set_dials()
returns the parameter set that will be used to fit the supplied rowid
of the workflow set. Note that workflow sets reference a parameter set associated with theworkflow
contained in theinfo
column by default, but can be fitted with a modified parameter set via theoption_add()
interface. This extractor returns the latter, if it exists, and returns the former if not, mirroring the process thatworkflow_map()
follows to provide tuning functions a parameter set. -
extract_parameter_dials()
returns theparameters
object that will be used to fit the supplied tuningparameter
in the supplied rowid
of the workflow set. See the above notes inextract_parameter_set_dials()
on precedence.
Usage
extract_workflow_set_result(x, id, ...)
## S3 method for class 'workflow_set'
extract_workflow(x, id, ...)
## S3 method for class 'workflow_set'
extract_spec_parsnip(x, id, ...)
## S3 method for class 'workflow_set'
extract_recipe(x, id, ..., estimated = TRUE)
## S3 method for class 'workflow_set'
extract_fit_parsnip(x, id, ...)
## S3 method for class 'workflow_set'
extract_fit_engine(x, id, ...)
## S3 method for class 'workflow_set'
extract_mold(x, id, ...)
## S3 method for class 'workflow_set'
extract_preprocessor(x, id, ...)
## S3 method for class 'workflow_set'
extract_parameter_set_dials(x, id, ...)
## S3 method for class 'workflow_set'
extract_parameter_dials(x, id, parameter, ...)
Arguments
x |
A workflow set outputted by |
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. |
parameter |
A single string for the parameter ID. |
Details
These functions supersede the pull_*()
functions (e.g.,
extract_workflow_set_result()
).
Value
The extracted value from the object, x
, as described in the
description section.
Note
The package supplies two pre-generated workflow sets, two_class_set
and chi_features_set
, and associated sets of model fits
two_class_res
and chi_features_res
.
The two_class_*
objects are based on a binary classification problem
using the two_class_dat
data from the modeldata package. The six
models utilize either a bare formula or a basic recipe utilizing
recipes::step_YeoJohnson()
as a preprocessor, and a decision tree,
logistic regression, or MARS model specification. See ?two_class_set
for source code.
The chi_features_*
objects are based on a regression problem using the
Chicago
data from the modeldata package. Each of the three models
utilize a linear regression model specification, with three different
recipes of varying complexity. The objects are meant to approximate the
sequence of models built in Section 1.3 of Kuhn and Johnson (2019). See
?chi_features_set
for source code.
Examples
library(tune)
two_class_res
extract_workflow_set_result(two_class_res, "none_cart")
extract_workflow(two_class_res, "none_cart")