shap.plots.image
- shap.plots.image(shap_values: ~shap._explanation.Explanation, pixel_values: ~typing.Optional[~numpy.ndarray] = None, labels: ~typing.Optional[list] = None, true_labels: ~typing.Optional[list] = None, width: ~typing.Optional[int] = 20, aspect: ~typing.Optional[float] = 0.2, hspace: ~typing.Optional[float] = 0.2, labelpad: ~typing.Optional[float] = None, cmap: ~typing.Optional[str] = <matplotlib.colors.LinearSegmentedColormap object>, show: ~typing.Optional[bool] = 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 or np.ndarray
List or np.ndarray (# samples x top_k classes) of names for each of the model outputs that are being explained.
- true_labels: list
List of a true image labels to plot
- 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.