如何在lightGBM中设置metric输出的频率?
How to set the frequency of metric output in lightGBM?
文档上说我们可以设置参数metric_freq来设置频率。我也试过参数verbose,参数设置为
params = {
'task': 'train',
'boosting_type': 'gbdt',
'objective': 'binary',
'metric': { 'binary_logloss'},
'metric_freq':10,
'num_leaves': 511,
'max_depth':8,
'learning_rate': 0.1,
'feature_fraction': 1,
'bagging_fraction': 0.8,
'bagging_freq': 1,
'verbose':10
}
但是,我还是得到了如下结果,
[1] valid_0's binary_logloss: 0.607487
Train until valid scores didn't improve in 5 rounds.
[2] valid_0's binary_logloss: 0.537403
[3] valid_0's binary_logloss: 0.479081
[4] valid_0's binary_logloss: 0.429961
[5] valid_0's binary_logloss: 0.388182
[6] valid_0's binary_logloss: 0.35239
[7] valid_0's binary_logloss: 0.321529
[8] valid_0's binary_logloss: 0.294795
[9] valid_0's binary_logloss: 0.271543
[10] valid_0's binary_logloss: 0.251267
[11] valid_0's binary_logloss: 0.233531
[12] valid_0's binary_logloss: 0.217997
[13] valid_0's binary_logloss: 0.204344
这表明参数metric_freq根本不起作用。那么哪个参数是用来设置输出频率的呢?
在R中,我们可以使用eval_freq,但是python包装器中没有eval_freq参数!
尝试将 verbose_eval=10 作为关键字参数(而不是在参数中)。
文档上说我们可以设置参数metric_freq来设置频率。我也试过参数verbose,参数设置为
params = {
'task': 'train',
'boosting_type': 'gbdt',
'objective': 'binary',
'metric': { 'binary_logloss'},
'metric_freq':10,
'num_leaves': 511,
'max_depth':8,
'learning_rate': 0.1,
'feature_fraction': 1,
'bagging_fraction': 0.8,
'bagging_freq': 1,
'verbose':10
}
但是,我还是得到了如下结果,
[1] valid_0's binary_logloss: 0.607487
Train until valid scores didn't improve in 5 rounds.
[2] valid_0's binary_logloss: 0.537403
[3] valid_0's binary_logloss: 0.479081
[4] valid_0's binary_logloss: 0.429961
[5] valid_0's binary_logloss: 0.388182
[6] valid_0's binary_logloss: 0.35239
[7] valid_0's binary_logloss: 0.321529
[8] valid_0's binary_logloss: 0.294795
[9] valid_0's binary_logloss: 0.271543
[10] valid_0's binary_logloss: 0.251267
[11] valid_0's binary_logloss: 0.233531
[12] valid_0's binary_logloss: 0.217997
[13] valid_0's binary_logloss: 0.204344
这表明参数metric_freq根本不起作用。那么哪个参数是用来设置输出频率的呢?
在R中,我们可以使用eval_freq,但是python包装器中没有eval_freq参数!
尝试将 verbose_eval=10 作为关键字参数(而不是在参数中)。