shap.summary_plot

shap.summary_plot(shap_values, features=None, feature_names=None, max_display=None, plot_type=None, color=None, axis_color='#333333', title=None, alpha=1, show=True, sort=True, color_bar=True, plot_size='auto', layered_violin_max_num_bins=20, class_names=None, class_inds=None, color_bar_label='Feature value', cmap=<matplotlib.colors.LinearSegmentedColormap object>, auto_size_plot=None, use_log_scale=False)

Create a SHAP beeswarm plot, colored by feature values when they are provided.

Parameters
shap_valuesnumpy.array

For single output explanations this is a matrix of SHAP values (# samples x # features). For multi-output explanations this is a list of such matrices of SHAP values.

featuresnumpy.array or pandas.DataFrame or list

Matrix of feature values (# samples x # features) or a feature_names list as shorthand

feature_nameslist

Names of the features (length # features)

max_displayint

How many top features to include in the plot (default is 20, or 7 for interaction plots)

plot_type“dot” (default for single output), “bar” (default for multi-output), “violin”,

or “compact_dot”. What type of summary plot to produce. Note that “compact_dot” is only used for SHAP interaction values.

plot_size“auto” (default), float, (float, float), or None

What size to make the plot. By default the size is auto-scaled based on the number of features that are being displayed. Passing a single float will cause each row to be that many inches high. Passing a pair of floats will scale the plot by that number of inches. If None is passed then the size of the current figure will be left unchanged.