【问题标题】:Training Random Forest in XGBoost 4J Spark在 XGBoost 4J Spark 中训练随机森林
【发布时间】:2020-11-30 18:39:01
【问题描述】:

如何在使用 XGBoost Spark 4J 训练随机森林时传递 num_parallel_tree 参数?

参考Random Forests in XGBoost后做了以下操作

    val hyperParams = Map(
       "booster" -> "gbtree",
        "objective" -> "binary:logistic", 
        "evalMetric" -> "logloss",
        "num_parallel_tree" -> 100)

    val xGBoostClassifier = new XGBoostClassifier(hyperParams)
      .setFeaturesCol(vectorAssembler.getOutputCol)
      .setLabelCol(labelColumnName)
      .setNumRound(1)

但最终模型只有一棵树。看起来num_parallel_tree 参数根本没有被使用。 即使是打印所有正在使用的超参数的 XGBoost 库的日志,也不会打印 num_parallel_tree

我们使用 XGBoost 1.0.0 版和 spark 2.4.2。

【问题讨论】:

    标签: apache-spark random-forest xgboost


    【解决方案1】:

    最终模型是 1 棵树。实际上这是很复杂的事情,但是您将不同的树合并为最终的树。重点是训练不同的树并以某种方式推导出最终更好的树。

    https://www.knime.com/blog/from-a-single-decision-tree-to-a-random-forest

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-13
      • 2017-01-22
      • 2012-10-25
      • 1970-01-01
      • 1970-01-01
      • 2013-08-30
      • 2017-03-19
      • 2016-05-27
      相关资源
      最近更新 更多