1

我正在尝试在 R 中运行 lightGBM,并且算法很快停止(仅在 10 棵树之后)。

这就是我得到的:

[LightGBM] [Info] Number of positive: 16271, number of negative: 430138
[LightGBM] [Info] Total Bins 1359
[LightGBM] [Info] Number of data: 446409, number of used features: 57
[LightGBM] [Info] Trained a tree with leaves=32 and max_depth=8
[1]:    train's binary_logloss:0.366686 eval's binary_logloss:0.36689 
[LightGBM] [Info] Trained a tree with leaves=32 and max_depth=8
[2]:    train's binary_logloss:0.250034 eval's binary_logloss:0.250388 
[LightGBM] [Info] Trained a tree with leaves=32 and max_depth=9
[3]:    train's binary_logloss:0.196744 eval's binary_logloss:0.19725 
[LightGBM] [Info] Trained a tree with leaves=32 and max_depth=8
[4]:    train's binary_logloss:0.17159  eval's binary_logloss:0.172322 
[LightGBM] [Info] Trained a tree with leaves=32 and max_depth=10
[5]:    train's binary_logloss:0.159984 eval's binary_logloss:0.160933 
[LightGBM] [Info] Trained a tree with leaves=32 and max_depth=11
[6]:    train's binary_logloss:0.154829 eval's binary_logloss:0.156185 
[LightGBM] [Info] Trained a tree with leaves=32 and max_depth=11
[7]:    train's binary_logloss:0.152656 eval's binary_logloss:0.154555 
[LightGBM] [Info] Trained a tree with leaves=32 and max_depth=13
[8]:    train's binary_logloss:0.151564 eval's binary_logloss:0.153874 
[LightGBM] [Info] Trained a tree with leaves=32 and max_depth=14
[9]:    train's binary_logloss:0.150981 eval's binary_logloss:0.153697 
[LightGBM] [Info] Trained a tree with leaves=32 and max_depth=11
[10]:   train's binary_logloss:0.150517 eval's binary_logloss:0.153833 

我正在运行此代码:

i.fold=folds!=i

train1 <- lgb.Dataset(train[i.fold,], label = Y[i.fold])
train2 <- lgb.Dataset(train[!i.fold,], label = Y[!i.fold])

valids <- list(eval = train2, train = train1)

set.seed(200+10*i)

param <- list(num_leaves = 32,
              learning_rate = 0.5,
              nthread = 8,
              silent = 1,
              objective = "binary",
              boosting = "gbdt",
              min_data_in_leaf = 1,
              feature_fraction = 1,
              bagging_fraction = 0.8,
              bagging_freq = 0,
              nrounds = 500,
              num_iteration = 500,
              num_iterations = 500,
              num_tree = 500,
              num_trees = 500,
              num_round = 500,
              num_rounds = 500,
              iterace = 10000,
              early_stopping_rounds = 500)


LGBM = lgb.train(param, train1, valid = valids)

我已经在参数中包含了我可以找到的迭代次数的每个替代方案,这就是为什么最后有这么多值为 500 的参数。

你知道它为什么这么早就停止了吗?

谢谢你,弗拉德

4

1 回答 1

0

aa = lgb.train(参数,d_train,valid_sets=[d_train,d_test],num_boost_round=8000,feature_name=f_names,verbose_eval=10,early_stopping_rounds = 6000)

我刚刚从我的一个 LightGBM 训练代码中复制了这个,使用上面的 num_boost_round 来根据需要设置迭代次数。

希望这是你的答案,

问候,

于 2018-10-11T22:41:50.730 回答