shap.image_plot

shap.image_plot(shap_values, pixel_values=None, labels=None, width=20, aspect=0.2, hspace=0.2, labelpad=None, show=True)

Plots SHAP values for image inputs.

Parameters
shap_values[numpy.array]

List of arrays of SHAP values. Each array has the shap (# samples x width x height x channels), and the length of the list is equal to the number of model outputs that are being explained.

pixel_valuesnumpy.array

Matrix of pixel values (# samples x width x height x channels) for each image. It should be the same shape as each array in the shap_values list of arrays.

labelslist

List of names for each of the model outputs that are being explained. This list should be the same length as the shap_values list.

widthfloat

The width of the produced matplotlib plot.

labelpadfloat

How much padding to use around the model output labels.

showbool

Whether matplotlib.pyplot.show() is called before returning. Setting this to False allows the plot to be customized further after it has been created.