dsgibbons / shap

A game theoretic approach to explain the output of any machine learning model.
https://shap-community.readthedocs.io/en/latest/
MIT License
25 stars 5 forks source link

fix: lightgbm call with categoricals bug #88

Closed thatlittleboy closed 1 year ago

thatlittleboy commented 1 year ago

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[bot] commented 1 year ago

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%) :arrow_up:

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