Welcome to SHAP’s documentation!

Contents:

plots module

shap.summary_plot(shap_values, features=None, feature_names=None, max_display=None, plot_type='dot', color=None, axis_color='#333333', title=None, alpha=1, show=True, sort=True, color_bar=True, auto_size_plot=True, layered_violin_max_num_bins=20)

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

shap_values
: numpy.array
Matrix of SHAP values (# samples x # features)
features
: numpy.array or pandas.DataFrame or list
Matrix of feature values (# samples x # features) or a feature_names list as shorthand
feature_names
: list
Names of the features (length # features)
max_display
: int
How many top features to include in the plot (default is 20, or 7 for interaction plots)
plot_type
: “dot” (default) or “violin”
What type of summary plot to produce
shap.dependence_plot(ind, shap_values, features, feature_names=None, display_features=None, interaction_index='auto', color='#1E88E5', axis_color='#333333', dot_size=16, alpha=1, title=None, show=True)

Create a SHAP dependence plot, colored by an interaction feature.

ind
: int
Index of the feature to plot.
shap_values
: numpy.array
Matrix of SHAP values (# samples x # features)
features
: numpy.array or pandas.DataFrame
Matrix of feature values (# samples x # features)
feature_names
: list
Names of the features (length # features)
display_features
: numpy.array or pandas.DataFrame
Matrix of feature values for visual display (such as strings instead of coded values)
interaction_index
: “auto”, None, or int
The index of the feature used to color the plot.
shap.force_plot(shap_values, features=None, feature_names=None, out_names=None, link='identity', plot_cmap='RdBu')

Visualize the given SHAP values with an additive force layout.

Indices and tables