shap.plots.bar

shap.plots.bar(shap_values, max_display=10, order=shap.Explanation.abs, clustering=None, clustering_cutoff=0.5, merge_cohorts=False, show_data='auto', show=True)

Create a bar plot of a set of SHAP values.

If a single sample is passed then we plot the SHAP values as a bar chart. If an Explanation with many samples is passed then we plot the mean absolute value for each feature column as a bar chart.

Parameters
shap_valuesshap.Explanation or shap.Cohorts or dictionary of shap.Explanation objects

A single row of a SHAP Explanation object (i.e. shap_values[0]) or a multi-row Explanation object that we want to summarize.

max_displayint

The maximum number of bars to display.

showbool

If show is set to False then we don’t call the matplotlib.pyplot.show() function. This allows further customization of the plot by the caller after the bar() function is finished.