-
Notifications
You must be signed in to change notification settings - Fork 25
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
UFuncTypeError when explaining lightgbm model #314
Comments
It seems linked to the categorical support in lightgbm: shap/shap#170 |
My quick and dirty fix would be like this:
instead of this code in
What do you think? Maybe the thresholds should be handled when loading the model instead? |
I see, good point. You are right, the categorical features are the problem. I was not aware how LightGBM does this comparison, I always thought it works like sklearn in that it treats everything like numerical. It might be that I did something wrong in the conversion. While I think your fix would work, we should think well about adding stuff to the explanation loop. I'd rather catch such things when we do the tree conversion. ... This would however be a more elaborate change. I want to think about this a bit more. :) Does your fix work for you for the time being? |
Yes, i confirm the dirty fix work properly! |
I have a LightGBM classifier working well.
But when i execute:
I got this error:
I search a little and it seems that the

self._tree.thresholds
contains some string values like (3||7||9||11||14||17||18||28||31||49||53||63||68||70||72||73||74||75||82||84||90||96||107||108||112||114||124||128||129||130||135||139
):I don't know why yet and i will look later.
The text was updated successfully, but these errors were encountered: