-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Description
Seeing this warning in Python unit tests:
tests/python_package_test/test_engine.py::test_linear_trees
/Users/runner/miniforge/envs/test-env/lib/python3.12/site-packages/lightgbm/basic.py:2137: UserWarning: categorical_feature keyword has been found inparamsand will be ignored.
Please use categorical_feature argument of the Dataset constructor to pass this parameter.
_log_warning(
That test case is not directly passing categorical_feature through params... that might be happening internal to lightgbm, and therefore something that users cannot avoid.
Reproducible example
I haven't not narrowed it down further yet, but can reliably reproduce it via running the tests.
pytest 'tests/python_package_test/test_engine.py::test_linear_trees'Environment info
LightGBM version or commit hash: 226e7f7
Command(s) you used to install LightGBM
cmake -B build -S . -DUSE_OPENMP=OFF
cmake --build build --target _lightgbm -j4
sh build-python.sh install --precompileAdditional Comments
I suspect that maybe this is a result of categorical_feature being treated as both a "param" here:
LightGBM/python-package/lightgbm/basic.py
Lines 2021 to 2025 in 3654eca
| if self.params is not None: | |
| # no min_data, nthreads and verbose in this function | |
| dataset_params = _ConfigAliases.get( | |
| "bin_construct_sample_cnt", | |
| "categorical_feature", |
But also being a keyword argument to Dataset.__init__():
LightGBM/python-package/lightgbm/basic.py
Line 1784 in 3654eca
| categorical_feature: _LGBM_CategoricalFeatureConfiguration = "auto", |