Create bagged trees
Ensemble models like bagged trees are more powerful than single decision trees. Each tree in the ensemble gives a vote, and the average or majority vote is your prediction. This ensures you use swarm intelligence instead of relying on a single tree. For bagged trees, the bootstrap method ensures that in every ensemble tree, only a bootstrapped sample (sampled with replacement) of the original dataset is used to train the tree and create the prediction.
Put this into practice by building a bagged classification tree yourself!
The credit card customers training data is pre-loaded as customers_train
.
This exercise is part of the course
Machine Learning with Tree-Based Models in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Create the specification
library(baguette)
spec_bagged <- ___ %>%
___ %>%
___(___, ___)
spec_bagged