Skip to content

lightgbm/boost-round-overridden

Rule boost-round-overridden
Pack LightGBM
Severity warning
Fix safe, with xpd check --fix
Library versions every version

LightGBM train() and cv() use num_iterations or an alias in params ahead of the num_boost_round argument. This call uses 50 rounds as its limit.

lgb.train({"n_estimators": 50}, train_set, num_boost_round=200)
lgb.train({"n_estimators": 50}, train_set)

The safe fix removes the ignored keyword argument or a final positional round count. It keeps the effective value in params. With later positional arguments, move them to keywords before dropping the round count. To change the number of rounds, set the intended value in params by hand.

The rule checks an explicit positive integer against a single iteration key or the primary num_iterations key. In current LightGBM the primary key wins even when a dictionary alias is also present.

Training parameters | Training engine

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

LightGBM uses $ROUNDS from params instead of the num_boost_round argument $LIMIT. Keep the effective round count in params.

Browse the other rules of the LightGBM pack.