Chapter 6 Fitting models with parsnip
Learning objectives:
- Identify ways in which model interfaces can differ. x
- Specify a model in
{parsnip}
. x - Fit a model with
parsnip::fit()
andparsnip::fit_xy()
. x - Describe how
{parsnip}
generalizes model arguments. x - Use
broom::tidy()
to convert model objects to a tidy structure. x - Use
dplyr::bind_cols()
and thepredict()
methods from{parsnip}
to make tidy predictions. - Find interfaces to other models in
{parsnip}
-adjacent packages.
Modeling Map
- Chapter Setup Below
# load parsnip, recipes, rsample, broom...
library(tidymodels)
library(AmesHousing)
# attach data
data(ames)
# log scale price
<- mutate(ames, Sale_Price = log10(Sale_Price))
ames
# train/test
set.seed(123)
<- initial_split(ames, prop = 0.80, strata = Sale_Price)
ames_split <- training(ames_split)
ames_train <- testing(ames_split) ames_test