lightgbm/deprecated-eval-set
| Rule | deprecated-eval-set |
|---|---|
| Pack | LightGBM |
| Severity | warning |
| Fix | unsafe, with xpd check --fix --unsafe-fixes |
| Library versions | LightGBM 4.7 and later |
LightGBM 4.7 deprecates eval_set on estimator fit(). Passing a non-None
eval_set together with a non-None eval_X or eval_y also raises
ValueError.
model.fit(X_train, y_train, eval_set=[(X_val, y_val)])model.fit(X_train, y_train, eval_X=(X_val,), eval_y=(y_val,))How to fix it
Section titled “How to fix it”Pass both eval_X and eval_y. For multiple validation sets, pass a tuple
of feature matrices and a tuple of label arrays in the same order.
For a single set, you can also pass the matrix and labels directly.
On LightGBM 4.7 or later, use xpd check --fix --unsafe-fixes to rewrite
eval_set=[(X_val, y_val)] when both values are simple names and the other
arguments are explicit. The fix preserves the validation data. It requires
the new API, so confirm the target version when xpd cannot find an installed
version. Migrate positional arguments, multiple sets, and calls already
passing replacement keywords by hand.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
LightGBM 4.7 deprecated eval_set on estimator fit(). Pass both eval_X and eval_y, using parallel tuples for multiple validation sets.Browse the other rules of the LightGBM pack.