Performing Cross-Validation
Explore the process of performing cross-validation with tidymodels in R. Understand how to set up data folds, track model accuracy metrics like sensitivity and specificity, and interpret the bias-variance tradeoff to improve decision tree model performance.
Coding the workflow
One of the many benefits of using the tidymodels family of R packages is the standardized approach it provides for coding machine learning workflows. The following code sets up a machine learning workflow for a CART classification decision tree:
Preparing the training data.
Declaring how the data should be used to train the model.
Specifying the machine learning algorithm to be used.
Orchestrating the workflow.
Setting up cross-validation
The vfold_cv() from the rsample package creates the folds to be used in cross-validation. The following code uses these parameters: