num_boost_round和n_estimators之间有什么区别

oct*_*ian 12 xgboost

我看到一些xgboost方法采用了一个参数num_boost_round,如下所示:

model = xgb.cv(params, dtrain,  num_boost_round=500, early_stopping_rounds=100)
Run Code Online (Sandbox Code Playgroud)

其他人则n_estimators喜欢这样:

model_xgb = xgb.XGBRegressor(n_estimators=360, max_depth=2, learning_rate=0.1)
Run Code Online (Sandbox Code Playgroud)

据我了解,每次使用提升时,都会创建一个新的估算器.这是不正确的?

如果是这样,那么数字num_boost_roundn_estimators应该是平等的,对不对?

小智 11

是的,它们是相同的,都指代相同的参数(请参阅此处的文档github 问题)。

不同名称的原因是因为xgb.XGBRegressor是 scikit-learn API 的一个实现;和 scikit-learn 通常n_estimators用来指代提升阶段的数量(例如GradientBoostingClassifier