【问题标题】:What is the difference between num_boost_round and n_estimatorsnum_boost_round 和 n_estimators 有什么区别
【发布时间】:2021-08-26 13:49:22
【问题描述】:

我看到有些xgboost方法带一个参数num_boost_round,像这样:

model = xgb.cv(params, dtrain,  num_boost_round=500, early_stopping_rounds=100)

其他人则像这样使用n_estimators

model_xgb = xgb.XGBRegressor(n_estimators=360, max_depth=2, learning_rate=0.1)

据我了解,每次应用提升都会创建一个新的估算器。这也不对吗?

如果是这样,那么数字num_boost_roundn_estimators 应该相等,对吧?

【问题讨论】:

标签: python xgboost


【解决方案1】:

是的,它们是相同的,都引用相同的参数(see the docs herethe github issue)。

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

【讨论】:

  • xgboost 的作者在 xgbclassfier 和 num_boost_round 中也使用了n_estimators,知道为什么在同一个 api 中他想这样做。 :(
  • 我在同一个优化过程中不小心将它们都设置为很高的数字,优化时间似乎成倍增加。我想知道将它们都设置为 1000 是否等同于将增强轮数设置为一百万。
【解决方案2】:

XGBoost 原生 API 中的 num_parallel_tree 等价于 n_estimators。

【讨论】:

    猜你喜欢
    • 2010-10-02
    • 2011-12-12
    • 2010-09-16
    • 2012-03-14
    • 2012-02-06
    • 2011-02-25
    • 2011-11-22
    • 2015-03-26
    • 2013-08-19
    相关资源
    最近更新 更多