如何在R中使用XGBoost算法进行回归?

Ama*_*eet 13 r machine-learning gbm boosting xgboost

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

objective = "reg:linear"
Run Code Online (Sandbox Code Playgroud)

我们可以进行回归,但我仍然需要对其他参数进行一些清晰度.如果有人可以提供R片段​​,这将是一个很大的帮助.

Gau*_*rav 5

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)
Run Code Online (Sandbox Code Playgroud)

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

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

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