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
Explanationwith 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
Explanationobject (i.e.shap_values[0]) or a multi-row Explanation object that we want to summarize.- max_displayint
How many top features to include in the bar plot (default is 10).
- showbool
Whether
matplotlib.pyplot.show()is called before returning. Setting this toFalseallows the plot to be customized further after it has been created.
Examples
See bar plot examples.