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

Extend SHAP-based features support for non tree-based models #14

Closed
Matgrb opened this issue Nov 19, 2020 · 2 comments
Closed

Extend SHAP-based features support for non tree-based models #14

Matgrb opened this issue Nov 19, 2020 · 2 comments
Labels
enhancement New feature or request important

Comments

@Matgrb
Copy link
Collaborator

Matgrb commented Nov 19, 2020

Problem Description
Currently the features based on SHAP library use TreeExplainer, which is limited to trees only. Because of that, one cannot use probatus with models different than that, e.g. SVM with rbf kernel

Desired Outcome
Probatus should support using other models, and use other explainer e.g. KernelExplainer in case the model is not tree based

Solution Outline

  • In function calculating shap values in utils, check if the model is tree or not tree based and apply the correct explainer. Consider making a warning about using KernelExplainer, and that it is very slow.
  • Check each feature using SHAP whether this works
  • Make a unit test for that.
  • Update the docs for every feature using shap that it also works for non-tree based models, yet it might be slow
  • Consider some optimizations e.g. maybe you don't need to calculate shap values for all samples, but you can subsample. You can check whether this is required at the end, based on the speed of the solution

Example how to use Kernel Explainer
https://shap.readthedocs.io/en/latest/example_notebooks/kernel_explainer/Iris%20classification%20with%20scikit-learn.html

@Matgrb Matgrb added enhancement New feature or request help wanted labels Nov 19, 2020
@Matgrb Matgrb changed the title Extend SHAP support for non tree-based models Extend SHAP-based features support for non tree-based models Nov 19, 2020
@Matgrb Matgrb linked a pull request Nov 19, 2020 that will close this issue
@Matgrb
Copy link
Collaborator Author

Matgrb commented Feb 4, 2021

@anilkumarpanda This issue is very high impact - low effort one. Currently ShapRFECV and SHAPImportanceResemblance only work with tree-based models. If you upgrade Shap to the newest version, and use Explainer instead of TreeExplainer (in utils/shap_helpers), you should would be able to add support right away to a wide array of new models.

Maybe you would be interested in picking this one?

@anilkumarpanda
Copy link
Contributor

Sounds, interesting. Will pick this one up next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request important
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants