workflows-internals | R Documentation |
.fit_pre()
, .fit_model()
, and .fit_finalize()
are internal workflow
functions for partially fitting a workflow object. They are only exported
for usage by the tuning package, tune,
and the general user should never need to worry about them.
.fit_pre(workflow, data)
.fit_model(workflow, control)
.fit_finalize(workflow)
workflow |
A workflow For For For |
data |
A data frame of predictors and outcomes to use when fitting the workflow |
control |
A |
library(parsnip)
library(recipes)
library(magrittr)
model <- linear_reg() %>%
set_engine("lm")
wf_unfit <- workflow() %>%
add_model(model) %>%
add_formula(mpg ~ cyl + log(disp))
wf_fit_pre <- .fit_pre(wf_unfit, mtcars)
wf_fit_model <- .fit_model(wf_fit_pre, control_workflow())
wf_fit <- .fit_finalize(wf_fit_model)
# Notice that fitting through the model doesn't mark the
# workflow as being "trained"
wf_fit_model
# Finalizing the workflow marks it as "trained"
wf_fit
# Which allows you to predict from it
try(predict(wf_fit_model, mtcars))
predict(wf_fit, mtcars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.