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
.
Este ejercicio forma parte del curso
Machine Learning with Tree-Based Models in R
Ejercicio interactivo práctico
Prueba este ejercicio completando el código de muestra.
# Create the specification
library(baguette)
spec_bagged <- ___ %>%
___ %>%
___(___, ___)
spec_bagged