-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[python-package] Support feature_names_in_
attribute via sklearn API
#6279
Comments
feature_names_in_
attribute via sklearn APIfeature_names_in_
attribute via sklearn API
Thanks for using LightGBM and taking the time to report this! We'd welcome this addition, would you like to contribute it? And a side question.... do you think it's an oversight that LightGBM/tests/python_package_test/test_sklearn.py Lines 1285 to 1288 in 255c93b
Using import lightgbm as lgb
from sklearn.utils.estimator_checks import check_estimator
check_estimator(lgb.LGBMClassifier())
check_estimator(lgb.LGBMRegressor()) But in the SLEP you linked, it says the following:
|
I would very much like to contribute to LightGBM and this seems like a great issue, with @ravwojdyla's blessing, I'd be happy to make this contribution. |
@nicklamiller sounds great - thank you! |
Do either of you know the answer to my question about |
@jameslamb I agree that based on SLEP007, this functionality should be implemented in I can open an issue in sklearn and propose this behavior is more rigorously checked with |
Thanks very much for the link to scikit-learn/scikit-learn#27907 @nicklamiller ! Please link to this issue from whatever one you create in |
Summary
sklearn API supports
feature_names_in_
attribute on a fitted model (SLEP007), which remembers the feature names/columns that went into themodel.fit
method. This can be very useful information, and is a standard worth conforming to. Afaiu right now that information is available in the booster:It shouldn't be too hard to conform to also expose that information via
feature_names_in_
attribute 🙏Motivation
It would conform to the sklearn API standards, improve usability of LightGBM models, especially when used along with other sklearn models and Pipelines.
References
The text was updated successfully, but these errors were encountered: