The LightGBM pack checks native training, estimator validation and prediction.
Its API checks follow LightGBM 4.7.0. xpd uses the installed version when it
can find one.
| Rules |
Safe fix |
Unsafe fix |
Manual fix |
| 10 |
1 |
3 |
6 |
| Rule |
Severity |
Fix |
What it finds |
| removed-training-keyword |
error |
unsafe |
LightGBM 4.0 removed the early_stopping_rounds, verbose_eval and fobj keywords from train() and cv(), and evals_result from train(). |
| deprecated-eval-set |
warning |
unsafe |
LightGBM 4.7 deprecates eval_set on estimator fit(). |
| bagging-without-frequency |
warning |
none |
LightGBM leaves row bagging disabled at its default frequency of zero. |
| cv-regression-stratified |
error |
none |
lightgbm.cv defaults to stratified=True. |
| dart-early-stopping |
warning |
none |
LightGBM's early stopping callback disables itself in DART mode. |
| early-stop-on-test |
warning |
none |
Early stopping chooses the number of boosting rounds using an evaluation set. |
| boost-round-overridden |
warning |
safe |
LightGBM train() and cv() use num_iterations or an alias in params ahead of the num_boost_round argument. |
| lightgbm-manual-cv-loop |
warning |
none |
A hand-rolled for tr, te in splitter.split(...): loop calling lightgbm.train(...) per fold reimplements cross-validation, rebuilds datasets manually, and makes per-fold early stopping and metric aggregation error-prone. |
| sample-weight-without-eval-weight |
warning |
none |
Passing sample_weight to LightGBM estimator fit() weights training gradients and Hessians, while validation sets (eval_X and eval_y, or eval_set) are scored unweighted unless eval_sample_weight is also passed. |
| Rule |
Severity |
Fix |
What it finds |
| predict-disabled-shape-check |
warning |
unsafe |
LightGBM's prediction engine normally checks that the number of features matches training. |
The rules follow LightGBM imports and local bindings. The configuration checks
look for literal settings. Module aliases work, as do direct imports that
keep the API's name.
Python API reference
The examples used LightGBM 4.7.0 and generated data with 240 rows and two
features.
| Rule |
Observed behavior |
| removed-training-keyword |
All obsolete keywords covered by the rule raised TypeError on the corresponding training or fit method. |
| deprecated-eval-set |
All four estimator classes warned for the old form, produced equal evaluation results with the replacement, and rejected a mix of the two forms. |
| bagging-without-frequency |
Native and estimator predictions were identical with the default and with a row fraction of 0.5 at frequency zero. At frequency one the predictions differed. |
| dart-early-stopping |
Training ran all eight rounds and left best_iteration at zero with both a callback and a positive stopping parameter. |
| boost-round-overridden |
Both train and cv used four rounds from params with eight passed as the argument. |
| predict-disabled-shape-check |
Booster prediction and classifier prediction on a pandas frame rejected an extra column by default and accepted it with the flag. |