run-forge | R Documentation |
forge()
according to a blueprintThis is a developer facing function that is only used if you are creating
your own blueprint subclass. It is called from forge()
and dispatches off
the S3 class of the blueprint
. This gives you an opportunity to forge the
new data in a way that is specific to your blueprint.
run_forge()
is always called from forge()
with the same arguments, unlike
run_mold()
, because there aren't different interfaces for calling
forge()
. run_forge()
is always called as:
run_forge(blueprint, new_data = new_data, outcomes = outcomes)
If you write a blueprint subclass for new_xy_blueprint()
,
new_recipe_blueprint()
, new_formula_blueprint()
, or new_blueprint()
,
then your run_forge()
method signature must match this.
run_forge(blueprint, new_data, ..., outcomes = FALSE)
## S3 method for class 'default_formula_blueprint'
run_forge(blueprint, new_data, ..., outcomes = FALSE)
## S3 method for class 'default_recipe_blueprint'
run_forge(blueprint, new_data, ..., outcomes = FALSE)
## S3 method for class 'default_xy_blueprint'
run_forge(blueprint, new_data, ..., outcomes = FALSE)
blueprint |
A preprocessing |
new_data |
A data frame or matrix of predictors to process. If
|
... |
Not used. |
outcomes |
A logical. Should the outcomes be processed and returned as well? |
run_forge()
methods return the object that is then immediately returned
from forge()
. See the return value section of forge()
to understand what
the structure of the return value should look like.
bp <- default_xy_blueprint()
outcomes <- mtcars["mpg"]
predictors <- mtcars
predictors$mpg <- NULL
mold <- run_mold(bp, x = predictors, y = outcomes)
run_forge(mold$blueprint, new_data = predictors)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.