N_estimator and number of booster



According to this stackoverflow post,
If I am correct, parameter of n_estimators in xgboost.XGBClassifier() should be equal to number of booster.

But after I tried:

iris = datasets.load_iris()
X = iris.data 
y = iris.target
model = XGBClassifier(n_estimators=5)
model.fit(X, y)

The dump_model have > 5 boosters which is confused me.


This is because Iris dataset has 3 classes, so we are performing multi-class classification. For multi-class classification task, XGBoost will fit [number of boosting rounds] * [number of classes] trees.