Skip to content
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

fix: lightgbm call with categoricals bug #88

Merged
merged 5 commits into from
May 31, 2023
Merged

Conversation

thatlittleboy
Copy link
Collaborator

Changes

The commits can be reviewed individually. In short,

  1. Refactor lightgbm tests into a TestClass to separate them from the xgboost, catboost etc. tests.
  2. Pass X directly into the .shap_values() function call (without first converting to numpy array).
  3. Add a test to make sure we don't introduce regression accidentally in the future.

Resolves #66 (read the issue for a background).

Related to issue slundberg#2144 (the original issue), and port of PR slundberg#2166 (but I implemented in a different way).

@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Merging #88 (f6975af) into master (fc8fb88) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #88      +/-   ##
==========================================
+ Coverage   53.39%   53.43%   +0.04%     
==========================================
  Files          90       90              
  Lines       13028    13029       +1     
==========================================
+ Hits         6956     6962       +6     
+ Misses       6072     6067       -5     
Impacted Files Coverage Δ
shap/explainers/_tree.py 69.83% <100.00%> (+0.48%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@thatlittleboy thatlittleboy added the bug Something isn't working label May 27, 2023
A slight reorganization of the tests into a Test Class, so that it's
easier to reason about the tests.

Also reduced the number of estimators to simplify tests slightly (runs
slightly faster),
fixed the `n_jobs=1` (would cause segmentation fault locally sometimes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LightGBM TreeExplainer.__call__() does not work with pandas DataFrame with Categoricals
2 participants