Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the frequency of metric output in lightGBM?

In the documents, it is said that we can set the parameter metric_freq to set the frequency. I have also tried the parameter verbose, the parameters are set as

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
}

However, I still got the result as following,

[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

Which showed that the parameter metric_freq didn't work at all. So which parameter is used to set the frequency of output?
In R, we can use eval_freq, but there is no eval_freq parameter in python wrapper!

like image 276
Yu Gu Avatar asked Jun 23 '17 10:06

Yu Gu


Video Answer


1 Answers

Try giving verbose_eval=10 as a keyword argument (rather than in params).

like image 96
Andy Harless Avatar answered Sep 24 '22 14:09

Andy Harless