【问题标题】:Looping not working as expected in R, while tuning xgboost parameters循环在 R 中无法按预期工作,同时调整 xgboost 参数
【发布时间】:2016-07-24 07:06:42
【问题描述】:

此问题基于:

xgboost in R: how does xgb.cv pass the optimal parameters into xgb.train

我正在尝试使用不同的参数进行类似的循环:

for (iter in 1:100){

param <- list(objective = "binary:logistic",
              eval_metric = "auc",
              max_depth = sample(2:6,1),
              eta = runif(.01,.1,.05),
              gamma = runif(.01,.05,.1), 
              subsample = runif(.9,.8,.7),
              colsample_bytree = runif(.8,.9,.5), 
              min_child_weight = sample(30:100,1),
              max_delta_step = sample(1:10,1)
)

但它会抛出错误,因为 param 在第一次迭代时将值设为:

max_depth : int 6
eta : num(0)
gamma: num(0)
subsample : num(0)
colsample_bytree : num(0)
min_child_weight: int 63
max_delta_step: int 2

什么可能导致这种行为?

【问题讨论】:

    标签: r parameter-passing xgboost


    【解决方案1】:

    好像我弄错了 runif 函数。

    这似乎有效:

    param <- list(objective = "binary:logistic",
                  eval_metric = "auc",
                  max_depth = sample(2:6,1),
                  eta = runif(1,.01,.05),
                  gamma = runif(1,.01,.1), 
                  subsample = runif(1,0.6,0.9),
                  colsample_bytree = runif(1,.5,1), 
                  min_child_weight = sample(30:100,1),
                  max_delta_step = sample(1:10,1)
    

    【讨论】:

      猜你喜欢
      • 2018-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-26
      • 2022-06-17
      • 2016-03-01
      • 1970-01-01
      • 2022-01-09
      相关资源
      最近更新 更多