r - xgboost:线性 boost 器 gblinear 中使用了哪些参数?

标签 r boost classification xgboost

在网上看,我仍然对线性助推器 gblinear 到底是什么感到困惑,我不是 alone .

documentation 之后它只有 3 个参数 lambda、lambda_biasalpha - 也许它应该说“附加参数”。

如果我理解正确,那么线性 boost 器会进行(相当标准的)线性 boost (带有正则化)。 在这种情况下,我只能理解上面的 3 个参数和 eta( boost 率)。 这也是它在 github 上的描述方式.

尽管如此,我发现树参数 gammamax_depthmin_child_weight 也对算法有影响。

这怎么可能?网络上是否有对线性增压器的完全清楚的描述?

看我的例子:

library(xgboost)

data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
train <- agaricus.train
test <- agaricus.test

然后设置

set.seed(100)
model <- xgboost(data = train$data, label = train$label, nrounds = 5, 
                 objective = "binary:logistic", 
                 params = list(booster = "gblinear", eta = 0.5, lambda = 1, lambda_bias = 1,gamma = 2,
                               early_stopping_rounds = 3))

给予

> [1]   train-error:0.018271  [2]   train-error:0.003071 
> [3]   train-error:0.001075  [4]   train-error:0.001075 
> [5]   train-error:0.000614

gamma=1

set.seed(100)
model <- xgboost(data = train$data, label = train$label, nrounds = 5, 
                 objective = "binary:logistic", 
                 params = list(booster = "gblinear", eta = 0.5, lambda = 1, lambda_bias = 1,gamma = 1,
                               early_stopping_rounds = 3))

导致

> [1]   train-error:0.013051  [2]   train-error:0.001842 
> [3]   train-error:0.001075  [4]   train-error:0.001075 
> [5]   train-error:0.001075

这是另一个“路径”。

类似于 max_depth:

set.seed(100)
model <- xgboost(data = train$data, label = train$label, nrounds = 5, 
                 objective = "binary:logistic", 
                 params = list(booster = "gblinear", eta = 0.5, lambda = 1, lambda_bias = 1, max_depth = 3,
                               early_stopping_rounds = 3))

> [1]   train-error:0.016122  [2]   train-error:0.002764 
> [3]   train-error:0.001075  [4]   train-error:0.001075 
> [5]   train-error:0.000768

set.seed(100)
model <- xgboost(data = train$data, label = train$label, nrounds = 10, 
                 objective = "binary:logistic", 
                 params = list(booster = "gblinear", eta = 0.5, lambda = 1, lambda_bias = 1, max_depth = 4,
                               early_stopping_rounds = 3))

> [1]   train-error:0.014740  [2]   train-error:0.004453 
> [3]   train-error:0.001228  [4]   train-error:0.000921 
> [5]   train-error:0.000614

最佳答案

我还不如在运行 gblinear 的间隙做一些深蹲,观察结果几乎每次都在变化,并声称做深蹲会对算法产生影响:)

严肃地说,gblinear 目前使用的算法不是您的“相当标准的线性 boost ”。造成随机性的是在每次迭代期间更新梯度时使用无锁并行化('hogwild')。设置种子不会影响任何东西;并且只有在运行单线程 (nthread=1) 时才能获得始终如一的可重现结果。我还建议不要使用使用最大可能数量的 OpenMP 线程的默认 nthread 设置来运行它,因为在许多系统上,它会由于线程拥塞而导致速度大大降低。 nthread 需要不高于物理内核数。

这种自由随机性可能会在某些情况下 boost 预测性能。但是,优点通常不会超过缺点。在某个时候,我将提交一个拉取请求,其中包含一个确定性并行化选项和一个在每个 boost 轮次中对功能选择进行一些额外控制的选项。

有关特定于助推器训练的所有可用参数的基本事实,请参阅 struct GBLinearTrainParam 的来源对于 gblinear 和 struct TrainParam 的来源对于 gbtree。

关于r - xgboost:线性 boost 器 gblinear 中使用了哪些参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42783098/

相关文章:

R dplyr,将 mutate 与 na.omit 一起使用会导致错误大小不兼容 (%d)

r - 使用 bartMachine R 包预测的概率是失败概率

python - 分类报告 : labels and target_names

java - weka中的字符串数组属性

r - ggplot 图例-scale_colour_manual 不起作用

r - 取消列出嵌套列表并使用 ggplot 绘图

r - 如何将列值转换为 R 中数据框中每个唯一值的行?

c++ - 使用 phoenix 访问 boost::tuple 的简单方法

c++ - 挥之不去的打开文件导致 "Too many open files"

c++ - boost::xtime 没有名为 'is_pos_infinity' 的成员