Chapter 12 Recipes

The pre-processing step

https://tidymodels.github.io/recipes/reference/index.html

library(tidymodels)
## ── Attaching packages ─────────────────────────────────── tidymodels 0.0.3 ──
## ✓ broom     0.5.4     ✓ purrr     0.3.3
## ✓ dials     0.0.4     ✓ recipes   0.1.9
## ✓ dplyr     0.8.4     ✓ rsample   0.0.5
## ✓ ggplot2   3.2.1     ✓ tibble    2.1.3
## ✓ infer     0.5.1     ✓ yardstick 0.0.5
## ✓ parsnip   0.0.5
## ── Conflicts ────────────────────────────────────── tidymodels_conflicts() ──
## x purrr::discard()    masks scales::discard()
## x dplyr::filter()     masks stats::filter()
## x dplyr::lag()        masks stats::lag()
## x ggplot2::margin()   masks dials::margin()
## x recipes::step()     masks stats::step()
## x recipes::yj_trans() masks scales::yj_trans()
library(AmesHousing)
ames <- AmesHousing::make_ames()
rec <- recipes::recipe(Sale_Price ~ ., data = ames)
rec %>% 
  step_novel(all_nominal()) %>%
  step_zv(all_predictors())
## Data Recipe
## 
## Inputs:
## 
##       role #variables
##    outcome          1
##  predictor         80
## 
## Operations:
## 
## Novel factor level assignment for all_nominal
## Zero variance filter on all_predictors