shap.group_difference_plot

shap.group_difference_plot(shap_values, group_mask, feature_names=None, xlabel=None, xmin=None, xmax=None, max_display=None, sort=True, show=True)

This plots the difference in mean SHAP values between two groups.

It is useful to decompose many group level metrics about the model output among the input features. Quantitative fairness metrics for machine learning models are a common example of such group level metrics.

Parameters
shap_valuesnumpy.array

Matrix of SHAP values (# samples x # features) or a vector of model outputs (# samples).

group_masknumpy.array

A boolean mask where True represents the first group of samples and False the second.

feature_nameslist

A list of feature names.