我正在尝试在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的原因。
你知道为什么这么早停止吗?
谢谢你, 维拉德
答案 0 :(得分: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来设置所需的迭代次数。
希望这是您的答案,
关于