I set n_estimators to 50 in lightgbm sklearn interface. When fitting stopped, n_estimators_ is 100. Why is this the case?
regressor = lightgbm.LGBMRegressor(n_estimators=50)
n_estimators (int, optional (default=100)) – Number of boosted trees to fit.
n_estimators_: True number of boosting iterations performed.
Why is n_estimators_ double that of n_estimators_? Aren't they supposed to be the same?
With
lightgbm==4.3.0on macOS (Python 3.11.7,scikit-learn==1.4.1), I'm not able to reproduce that.I suspect that maybe you called
.fit()twice, passing the already-fitted model in asinit_modelthe second time, which resulted in LightGBM performing an additional 50 rounds of boosting.Those properties have slightly different meanings:
.n_estimators= maximum number of boosting rounds to perform next timefit()is called.n_estimators_= total number of trees in the model