ShapTree#

class interpret.greybox.ShapTree(model, data, feature_names=None, feature_types=None, **kwargs)#

Exposes tree specific SHAP approximation, in interpret API form. If using this please cite the original authors as can be found here: slundberg/shap

Initializes class.

Parameters:
  • model – A tree object that works with Tree SHAP.

  • data – Data used to initialize SHAP with.

  • feature_names – List of feature names.

  • feature_types – List of feature types.

  • **kwargs – Kwargs that will be sent to shap.TreeExplainer

explain_local(X, y=None, name=None, **kwargs)#

Provides local explanations for provided instances.

Parameters:
  • X – Numpy array for X to explain.

  • y – Numpy vector for y to explain.

  • name – User-defined explanation name.

  • **kwargs – Kwargs that will be sent to SHAP

Returns:

An explanation object, visualizing feature-value pairs for each instance as horizontal bar charts.