LightGBM
The LightGBM pack has 6 rules, and xpd can fix 4 of them.
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.
Training and validation
Section titled “Training and validation”| 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. |
| dart-early-stopping | warning | none | LightGBM's early stopping callback disables itself in DART mode. |
| boost-round-overridden | warning | safe | LightGBM train() and cv() use num_iterations or an alias in params ahead of the num_boost_round argument. |
Prediction
Section titled “Prediction”| 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.
Runtime evidence
Section titled “Runtime evidence”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. |