Crafting the Recipe
Explore how to use the recipes package in R to prepare and transform data for training classification trees. Learn to convert features into factors and specify prediction formulas, enabling effective decision tree models using Titanic dataset.
We'll cover the following...
Getting started
This lesson uses the recipes package of the tidymodels family as the start of the R code script to train a CART classification decision tree. The code in this lesson is developed step by step. Not surprisingly, the first step is to load the required R packages and the Titanic training set.
Run the following code to get things started:
This code script loads the following R packages:
tidyverse: The family of packages that provide functionality for acquiring, wrangling, and visualizing data.tidymodels: The family of packages extending thetidyversewith functionality for machine learning.rattle: A package providing a graphical user interface (GUI) for R. In this course,rattleis used to visualize decision trees. ...