Performing Cross-Validation
Learn how to use cross-validation to calculate accuracy estimates using tidymodels.
We'll cover the following...
We'll cover the following...
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: