add_model() adds a parsnip model to the workflow.
remove_model() removes the model specification as well as any fitted
model object. Any extra formulas are also removed.
update_model() first removes the model then adds the new specification to
1 2 3 4 5
A parsnip model specification.
An optional formula override to specify the terms of the model. Typically, the terms are extracted from the formula or recipe preprocessing methods. However, some models (like survival and bayesian models) use the formula not to preprocess, but to specify the structure of the model. In those cases, a formula specifying the model structure must be passed unchanged into the model call itself. This argument is used for those purposes.
add_model() is a required step to construct a minimal workflow.
x, updated with either a new or removed model.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
library(parsnip) lm_model <- linear_reg() lm_model <- set_engine(lm_model, "lm") regularized_model <- set_engine(lm_model, "glmnet") workflow <- workflow() workflow <- add_model(workflow, lm_model) workflow workflow <- add_formula(workflow, mpg ~ .) workflow remove_model(workflow) fitted <- fit(workflow, data = mtcars) fitted remove_model(fitted) remove_model(workflow) update_model(workflow, regularized_model) update_model(fitted, regularized_model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.