如何在lightGBM中设置度量输出的频率?

时间:2017-06-23 10:52:36

标签: python data-mining 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参数!

1 个答案:

答案 0 :(得分:1)

尝试将verbose_eval = 10作为关键字参数(而不是params)。