Learn R Programming

workflows (version 0.1.1)

fit-workflow: Fit a workflow object

Description

Fitting a workflow currently involves two main steps:

Usage

# S3 method for 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

Value

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

Details

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

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab