Skip to content

XGBoost

The XGBoost pack checks native Booster and scikit-learn estimator code against XGBoost 3.4 on files that import xgboost. Safe and unsafe autofixes cover ineffective-max-quantile-batches and simple removed-gpu-hist rewrites.

Rules Safe fix Unsafe fix Manual fix
11 1 1 9
Rule Severity Fix What it finds
removed-fit-keywords error none XGBoost 2.1 removed eval_metric, early_stopping_rounds and callbacks from the scikit-learn estimator's fit method.
removed-gpu-hist error unsafe XGBoost 3.1 removed the gpu_hist tree method.
ineffective-max-quantile-batches warning safe XGBoost 3.3 deprecated max_quantile_batches and made it ineffective.
Rule Severity Fix What it finds
quantile-eval-without-train-ref error none XGBoost train requires a separate QuantileDMatrix or ExtMemQuantileDMatrix used for evaluation to reference the exact matrix passed as dtrain.
reused-early-stopping-callback warning none XGBoost's EarlyStopping callback stores training history and a count of rounds without improvement.
early-stop-on-test warning none Early stopping chooses the number of boosting rounds using an evaluation set.
cv-shuffled-time-series warning none xgboost.cv defaults to shuffle=True.
xgboost-manual-cv-loop warning none A hand-rolled for tr, te in splitter.split(...): loop calling xgboost.train(...) per fold reimplements cross-validation, rebuilds DMatrix objects manually, and makes per-fold early stopping and metric aggregation error-prone.
sample-weight-without-eval-weight warning none Passing sample_weight to XGBoost estimator fit() weights training gradients and Hessians, while eval_set entries are scored unweighted unless sample_weight_eval_set is also passed.
Rule Severity Fix What it finds
native-predict-after-early-stopping warning none XGBoost's native Booster.predict and Booster.inplace_predict use all retained rounds by default, including any rounds after early stopping found the best validation score.
dmatrix-rebuilt-for-predict warning none XGBoost's Booster.inplace_predict can score supported batches for tree boosters without allocating a new DMatrix for each batch.