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 in params and 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 --precompile
Additional Comments
I suspect that maybe this is a result of categorical_feature being treated as both a "param" here:
https://github.com/microsoft/LightGBM/blob/3654ecaaa1a33628dd2b1cc936c3f1cfd31079a4/python-package/lightgbm/basic.py#L2021-L2025
But also being a keyword argument to Dataset.__init__():
https://github.com/microsoft/LightGBM/blob/3654ecaaa1a33628dd2b1cc936c3f1cfd31079a4/python-package/lightgbm/basic.py#L1784
Description
Seeing this warning in Python unit tests:
That test case is not directly passing
categorical_featurethroughparams... that might be happening internal tolightgbm, 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_featurebeing treated as both a "param" here:https://github.com/microsoft/LightGBM/blob/3654ecaaa1a33628dd2b1cc936c3f1cfd31079a4/python-package/lightgbm/basic.py#L2021-L2025
But also being a keyword argument to
Dataset.__init__():https://github.com/microsoft/LightGBM/blob/3654ecaaa1a33628dd2b1cc936c3f1cfd31079a4/python-package/lightgbm/basic.py#L1784