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

BUG: missing **dmatrix_props in shape_interaction module #3510

Open
3 of 4 tasks
bernddude opened this issue Feb 17, 2024 · 1 comment
Open
3 of 4 tasks

BUG: missing **dmatrix_props in shape_interaction module #3510

bernddude opened this issue Feb 17, 2024 · 1 comment
Assignees
Labels
awaiting feedback Indicates that further information is required from the issue creator bug Indicates an unexpected problem or unintended behaviour

Comments

@bernddude
Copy link

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

@bernddude bernddude added the bug Indicates an unexpected problem or unintended behaviour label Feb 17, 2024
@CloseChoice CloseChoice self-assigned this Feb 22, 2024
@CloseChoice
Copy link
Collaborator

Thanks for the report.
We are currently using dmatrix properties for xgboost models, see e.g. here. Note that we are only passing specific dmatrix properties, namely:

    properties_to_pass = ["missing", "n_jobs", "enable_categorical", "feature_types"]

Do you miss any here? Is it possible for you to provide a reproducible example where we can check that properties are ignored?

@CloseChoice CloseChoice added the awaiting feedback Indicates that further information is required from the issue creator label Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Indicates that further information is required from the issue creator bug Indicates an unexpected problem or unintended behaviour
Projects
None yet
Development

No branches or pull requests

2 participants