【问题标题】:How to use XGBoost algorithm for regression in R?如何在 R 中使用 XGBoost 算法进行回归?
【发布时间】:2016-01-17 12:05:02
【问题描述】:

我正在尝试使用 XGBoost 技术进行预测。由于我的因变量是连续的,我使用 XGBoost 进行回归,但各种门户中可用的大多数参考资料都用于分类。虽然我知道使用

objective = "reg:linear"

我们可以进行回归,但我仍然需要对其他参数进行一些澄清。如果有人能提供给我一个 R sn-p,那将是一个很大的帮助。

【问题讨论】:

  • @Amarjeet:您在尝试运行它时是否真的收到错误,或者您的问题是如何调整参数?
  • @Amarjeet 关于该主题的任何更新?我也有同样的问题。

标签: r machine-learning gbm xgboost boosting


【解决方案1】:
xgboost(data = X, 
        booster = "gbtree", 
        objective = "binary:logistic", 
        max.depth = 5, 
        eta = 0.5, 
        nthread = 2, 
        nround = 2, 
        min_child_weight = 1, 
        subsample = 0.5, 
        colsample_bytree = 1, 
        num_parallel_tree = 1)

这些是您在使用树木助推器时可以使用的所有参数。对于线性助推器,您可以使用以下参数来玩...

xgboost(data = X, 
        booster = "gblinear", 
        objective = "binary:logistic", 
        max.depth = 5, 
        nround = 2, 
        lambda = 0, 
        lambda_bias = 0, 
        alpha = 0)

这些参数的详细含义可以参考xgboost CRAN文档中xg.train()的描述。

【讨论】:

  • 我知道这是一个非常广泛的问题,但是否有任何与回归相关的具体答案有助于理解。
  • 线性回归和二元逻辑回归是 xgboost 包中最常用的方法... xgboost 中的所有参数仅用于操纵算法的提升部分...用于操作回归技术的包...它的 ols 回归或二元逻辑...
【解决方案2】:

我找到的参数的最佳描述在

https://github.com/dmlc/xgboost/blob/master/doc/parameter.md

在 Kaggle 脚本存储库中有许多在 R 中使用 XGBoost 的示例。例如:

https://www.kaggle.com/michaelpawlus/springleaf-marketing-response/xgboost-example-0-76178/code

【讨论】:

    猜你喜欢
    • 2017-07-20
    • 2021-03-11
    • 2016-10-30
    • 2017-02-12
    • 1970-01-01
    • 1970-01-01
    • 2019-11-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多