From the course: Applied Machine Learning: Ensemble Learning
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Hands-on coding with XGBoost
From the course: Applied Machine Learning: Ensemble Learning
Hands-on coding with XGBoost
- [Narrator] I'm going to show a demo for XGBoost similar to what we've done with our other models. We're going to loop over a different number of trees and we're going to plot that. Let's run this and see what happens. What I've done here is I have one tree here, two trees here, 5, 10, 20, and 50. Now remember, XGBoost is like golfing. Each subsequent tree is fixing the error or starting off from where you were trying to get the ball closer to the hole, so to speak. This is just one tree and it's a weak learner, so the depth is not very deep. Also note that there's a learning rate as well, so these red bars aren't going up to the top, but we're slowly inching that ball towards the hole, so to speak. So that's one tree. You can see that with one tree, the performance isn't going to be very good because it has pretty big errors still. So here's two trees and in gray, I've plotted the different trees. I've actually changed the transparency of them. So the more recent the tree, the…