shapiq.plot.bar_plotΒΆ

shapiq.plot.bar_plot(list_of_interaction_values, *, feature_names=None, show=False, abbreviate=True, max_display=10, global_plot=True, plot_base_value=False)[source]ΒΆ

Draws interaction values as a bar plot (adapted from SHAP).

The function draws the interaction values on a bar plot. The interaction values can be aggregated into a global explanation or plotted separately.

Parameters:
  • list_of_interaction_values (list[InteractionValues]) – A list containing InteractionValues objects.

  • feature_names (ndarray | list[str] | None) – The feature names used for plotting. If no feature names are provided, the feature indices are used instead. Defaults to None.

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

  • abbreviate (bool) – Whether to abbreviate the feature names. Defaults to True.

  • max_display (int | None) – The maximum number of features to display. Defaults to 10. If set to None, all features are displayed.

  • global_plot (bool) – Weather to aggregate the values of the different InteractionValues objects into a global explanation (True) or to plot them as separate bars (False). Defaults to True. If only one InteractionValues object is provided, this parameter is ignored.

  • plot_base_value (bool) – Whether to include the base value in the plot or not. Defaults to False.

Return type:

Axes | None

Returns:

If show is False, the function returns the axis of the plot. Otherwise, it returns None.