shapiq.plot.beeswarm_plotΒΆ

shapiq.plot.beeswarm_plot(interaction_values_list, data, *, max_display=10, feature_names=None, abbreviate=True, alpha=0.8, row_height=0.4, ax=None, rng_seed=42, show=True)[source]ΒΆ

Plots a beeswarm plot of SHAP-IQ interaction values. Based on the SHAP beeswarm plot.

The beeswarm plot visualizes how the magnitude and direction of interaction effects are distributed across all samples in the data, revealing dependencies between the feature’s value and the strength of the interaction.

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

  • data (DataFrame | ndarray) – The input data used to compute the interaction values.

  • max_display (int | None) – Maximum number of interactions to display. Defaults to 10.

  • feature_names (list[str] | None) – Names of the features. If not given, feature indices will be used. Defaults to None.

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

  • alpha (float) – The transparency level for the plotted points, ranging from 0 (transparent) to 1 (opaque). Defaults to 0.8.

  • row_height (float) – The height in inches allocated for each row on the plot. Defaults to 0.4.

  • ax (Axes | None) – Matplotlib Axes object to plot on. If None, a new figure and axes will be created.

  • rng_seed (int | None) – Random seed for reproducibility. Defaults to 42.

  • show (bool) – Whether to show the plot. Defaults to True. If False, the function returns the axis of the plot.

Return type:

Axes | None

Returns:

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