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.
Cet exercice fait partie du cours
Machine Learning with Tree-Based Models in R
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Create the specification
library(baguette)
spec_bagged <- ___ %>%
___ %>%
___(___, ___)
spec_bagged