xydrolase / shap4j

JVM bindings for the SHAP library
MIT License
6 stars 0 forks source link

Added support for the Saabas algorithm for approximate SHAP values. #4

Closed xydrolase closed 4 years ago

xydrolase commented 4 years ago

Motivation

Adding support for the Saabas algorithm for computing approximate SHAP values. This algorithm is implemented as the dense_tree_saabas function in the C++ implementation.

Solution details

Added a new boolean parameter, approximate, to the TreeExplainer.shapValues() methods, which mirrors the Python interface TreeExplainer.shap_values():

def shap_values(self, X, y=None, tree_limit=None, approximate=False, check_additivity=True):

Results

Added new unit tests to verify the output of the approximate SHAP values. The expected values are generated using the SHAP Python package.