-
-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
plot_partial_dependence() API does not work with LightGBM regression model #16878
Comments
Thanks for the report. It's an interesting problem, for now I'm not sure about the best way to fix it.
|
As a side note, I'm pretty sure some scikit-learn's common test must be failing as a result of their current approach. If not we should add one. |
Thanks @rth for the reply. Yeah, this is an interesting problem. I agree that the fix I have is not ideal. You No.2 idea might be the best approach that each estimator can register their "properties to check", then Another idea in my mind is to keep a bit |
With the new With that in mind, I am closing this issue. |
Describe the bug
I use LightGBM 2.3.2 to train a regression model, then call the
plot_partial_dependence()
to create a partial dependence graph. Then I encountered into the following error.Then I trace down the code, I found
LGBMRegressor
's implementation uses@property
to the attributes. Example below:Reference here: https://github.com/Microsoft/LightGBM/blob/master/python-package/lightgbm/sklearn.py
In
utils/validation.py
, thecheck_is_fitted
function only look at thevars(estimator)
which returns empty dictionary. So the check fails, though the estimator actually has the above properties.Steps/Code to Reproduce
Create a LightGBM regressor, then call plot_partial_dependence() API to plot.
Expected Results
Expect a graph to be generated.
Actual Results
The errors above.
Versions
The text was updated successfully, but these errors were encountered: