消除LightGBM训练过程中出现的[LightGBM] [Warning] No further splits with positive gain, best gain: -inf

1.总结一下Github上面有关这个问题的解释:

  1. 这意味着当前迭代中树的学习应该停止,因为不能再分裂了。
  2. "min_data_in_leaf"的设定值太大导致的,应该设一个小一点的。
  3. 这不是一个bug或者error,而是一个特性,可以忽略掉(但是本人看着很不爽)。输出消息是警告用户您的参数可能错误,或者您的数据集不容易学习。

2.消除办法:

  1. 把"min_data_in_leaf"改小一点。
  2. 在参数字典中增加参数"verbose: -1"(新参数与前面的参数之间记得加逗号

本人采用第二种办法,新的训练过程中不再出现改该警告。

参考:Suppress LightGBM Warning

# 设置 LightGBM 参数(正则化和复杂度控制) > param <- list( + objective = "regression", + metric = "rmse", + learning_rate = 0.01, + num_leaves = 31, + feature_fraction = 0.8, + bagging_fraction = 0.8, + lambda_l1 = 0.1, + lambda_l2 = 0.2 + ) > > # 使用早停机制训练 LightGBM > lgb_model <- lgb.train( + params = params, + data = lgb_train, + nrounds = params$nrounds, + valids = list(validation = lgb.Dataset(test_matrix, label = test_labels)), + early_stopping_rounds = 10, + verbose = 1 + ) [LightGBM] [Info] Number of positive: 231, number of negative: 154 [LightGBM] [Info] Auto-choosing row-wise multi-threading, the overhead of testing was 0.000443 seconds. You can set `force_row_wise=true` to remove the overhead. And if memory is not enough, you can set `force_col_wise=true`. [LightGBM] [Info] Total Bins 792 [LightGBM] [Info] Number of data points in the train set: 385, number of used features: 13 [LightGBM] [Info] [binary:BoostFromScore]: pavg=0.600000 -> initscore=0.405465 [LightGBM] [Info] Start training from score 0.405465 [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] Stopped training because there are no more leaves that meet the split requirements [1]: validation's binary_error:0.395833 Will train until there is no improvement in 10 rounds. [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] Stopped training because there are no more leaves that meet the split requirements [2]: validation's binary_error:0.395833 [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] Stopped training because there are no more leaves that meet the split requirements [3]: validation's binary_error:0.395833 [LightGBM] [Warning] No further splits with positive gain, best gain: -inf [LightGBM] [Warning] Stopped training because there are no more leaves that meet the split requirements [4]: validation's binary_
最新发布
03-16
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值