shap/shap

BUG: missing **dmatrix_props in shape_interaction module

bernddude opened this issue · 1 comments

Issue Description

I have been using the new feature to handle categorial values in XGBoost.
However it does require to provide an attribute to the DMatrix function like this xgboost.DMatrix(X,enable_categorical=True)
In the main module i was able to 'fake' this by changing dmatrix_props externally to change the line
X=xgboost.DMatrix(X, **dmatrix_props)

However, the shape_interaction_values module only uses
X = xgboost.DMatrix(X)

hence its very difficult to use the XGboost feature.

do you think it would be possible to change the latter routine in the same way ?

also it would be nice if there is an API way to change dmatrix_props. i assume there is and i might just not see it ?

Minimal Reproducible Example

build any XGB model using 

xgb.DMatrix(X_test, label=y_test,enable_categorical=True)

and try to run 

shap_interaction_values = shap.TreeExplainer(model).shap_interaction_values(X)

where model is the XGBoost model

Traceback

No response

Expected Behavior

No response

Bug report checklist

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest release of shap.
  • I have confirmed this bug exists on the master branch of shap.
  • I'd be interested in making a PR to fix this bug

Installed Versions

'0.44.0'

I am using OSX Sonoma and Python 3.9