O'Reilly logo

Ensemble Machine Learning by Ankit Dixit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tuning the number of trees and max depth in XGBoost

There is a relationship between the number of trees in the model and the depth of each tree. We would expect that deeper trees result in fewer trees being required in the model, and  vice versa, where simpler trees (such as decision stumps) require many more trees to achieve similar results. 

We can investigate this relationship by evaluating a grid of n_estimators and max_depth configuration values. To prevent the evaluation from taking too long, we will limit the total number of configuration values evaluated. Parameters are chosen to tease out the relationship rather than optimize the model.

We will create a grid of four different n_estimators values (50, 100, 150, 200) and four different ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required