ShapKernel#
Link to Algorithm description: SHAP
- class interpret.blackbox.ShapKernel(model, data, feature_names=None, feature_types=None, **kwargs)#
Exposes SHAP kernel explainer from shap package, in interpret API form. If using this please cite the original authors as can be found here: slundberg/shap
Initializes class.
- Parameters:
model – model or prediction function of model (predict_proba for classification or predict for regression)
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.KernelExplainer
- 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.