# How to make LightGBM to suppress output?

I'm trying for a while to figure out how to "shut up" LightGBM. Especially, I want to suppress the output of LightGBM during training (the feedback on the boosting steps).

My model:

params = {
'objective': 'regression',
'learning_rate' :0.9,
'max_depth' : 1,
'metric': 'mean_squared_error',
'seed': 7,
'boosting_type' : 'gbdt'
}

gbm = lgb.train(params,
lgb_train,
num_boost_round=100000,
valid_sets=lgb_eval,
early_stopping_rounds=100)


I tried to add verbose=0 as suggested in the docs. But this does not work. https://github.com/microsoft/LightGBM/blob/master/docs/Parameters.rst

Does anyone know how to suppress LightGBM output during training?

• Perhaps it's verbose_eval you're looking for? lightgbm.readthedocs.io/en/latest/Python-API.html – bradS Jun 17 '19 at 15:12
• Yep, got rid of most feedback! Thanks! Any idea how I can also suppress warnings, because I still receive a lot of warnings as feedback. – Peter Jun 17 '19 at 15:17
• What kind of errors are you getting? – bradS Jun 17 '19 at 20:57
• It is „No further splits with positive gain“, likely caused by min_data_in_leaf. However, I would like to keep the configuration. My current application is a parameter search. – Peter Jun 17 '19 at 21:08
• This is the latest I update on the issue that I can see: github.com/Microsoft/LightGBM/issues/… – bradS Jun 17 '19 at 21:13

As @Peter has suggested, setting verbose_eval = -1 suppresses most of LightGBM output (link: here).

However, LightGBM may still return other warnings - e.g. No further splits with positive gain. This can be suppressed as follows (source: here ):

lgb_train = lgb.Dataset(X_train, y_train, params={'verbose': -1}, free_raw_data=False)
lgb_eval = lgb.Dataset(X_test, y_test, params={'verbose': -1},free_raw_data=False)
gbm = lgb.train({'verbose': -1}, lgb_train, valid_sets=lgb_eval, verbose_eval=False)


To suppress (most) output from LightGBM, the following parameter can be set.

Suppress warnings: 'verbose': -1 must be specified in params={}.

Suppress output of training iterations: verbose_eval=False must be specified in the train{} parameter.

Minimal example:

params = {
'objective': 'regression',
'learning_rate' : 0.9,
'max_depth' : 1,
'metric': 'mean_squared_error',
'seed': 7,
'verbose': -1,
'boosting_type' : 'gbdt'
}

gbm = lgb.train(params,
lgb_train,
num_boost_round=100000,
valid_sets=lgb_eval,
verbose_eval=False,
early_stopping_rounds=100)