Skip to content

optuna_integration/lightgbm-tuner-deprecated-feature-args

Pack Severity Fix Versions
Optuna Integration warning none, edit by hand All versions

LightGBMTuner and LightGBMTunerCV emit a deprecation UserWarning when feature_name= or categorical_feature= is passed, because LightGBM 4.6 removed those parameters from lgb.train and lgb.cv.

tuner = LightGBMTuner(params, dtrain, valid_sets=[dval], categorical_feature=["cat_col"])
dtrain = lgb.Dataset(X_train, label=y_train, categorical_feature=["cat_col"])
tuner = LightGBMTuner(params, dtrain, valid_sets=[dval])

Calls to LightGBMTuner or LightGBMTunerCV with non-None feature_name= or categorical_feature=.

Declare feature_name and categorical_feature on the lightgbm.Dataset constructor instead of passing them to the tuner.

Passing feature_name= or categorical_feature= to LightGBMTuner or LightGBMTunerCV is deprecated because LightGBM 4.6+ removed those arguments from train() and cv(). Pass them to lightgbm.Dataset() instead.

See all rules in the Optuna Integration pack.