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 toNone.show (
bool) β Whethermatplotlib.pyplot.show()is called before returning. Default isTrue. Setting this toFalseallows the plot to be customized further after it has been created.abbreviate (
bool) β Whether to abbreviate the feature names. Defaults toTrue.max_display (
int|None) β The maximum number of features to display. Defaults to10. If set toNone, 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 toTrue. 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 toFalse.
- Return type:
- Returns:
If
showisFalse, the function returns the axis of the plot. Otherwise, it returnsNone.