fit-workflow: Fit a workflow object

Description Usage Arguments Details Value Examples

Description

Fitting a workflow currently involves two main steps:

Usage

1
2
## S3 method for class 'workflow'
fit(object, data, ..., control = control_workflow())

Arguments

object

A workflow

data

A data frame of predictors and outcomes to use when fitting the workflow

...

Not used

control

A control_workflow() object

Details

In the future, there will also be postprocessing steps that can be added after the model has been fit.

Value

The workflow object, updated with a fit parsnip model in the object$fit$fit slot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(parsnip)
library(recipes)

model <- linear_reg()
model <- set_engine(model, "lm")

base_workflow <- workflow()
base_workflow <- add_model(base_workflow, model)

formula_workflow <- add_formula(base_workflow, mpg ~ cyl + log(disp))

fit(formula_workflow, mtcars)

recipe <- recipe(mpg ~ cyl + disp, mtcars)
recipe <- step_log(recipe, disp)

recipe_workflow <- add_recipe(base_workflow, recipe)

fit(recipe_workflow, mtcars)

tidymodels/workflows documentation built on Jan. 3, 2020, 4:47 a.m.