shapiq.plot.network_plot¶

shapiq.plot.network_plot(interaction_values, *, feature_names=None, show=False, **kwargs)[source]¶

Draws the interaction network plot [Mus24net].

An interaction network is a graph where the nodes represent the features and the edges represent the interactions. The edge width is proportional to the interaction value. The color of the edge is red if the interaction value is positive and blue if the interaction value is negative. The network plot has been used to visualize local Shapley interaction values [Mus24net] and is a variation of the graph plots presented by Inglis et al. (2022) [Ing22]. Below is an example of an interaction network with an image in the center.

../_images/network_example.png
Parameters:
  • interaction_values (InteractionValues) – The interaction values as an interaction object.

  • feature_names (list[Any] | dict[int, Any] | None) – The feature names used for plotting. List/dict mapping index of the player as index/key to name. If no feature names are provided, the feature indices are used instead. Defaults to None.

  • show (bool) – Whether to show the plot. Defaults to False. If False, the figure and the axis containing the plot are returned, otherwise None.

  • **kwargs (Any) – Additional keyword arguments passed to the plotting function of shapiq.plot.si_graph_plot.si_graph_plot(). See the documentation of that function for more details on the available keyword arguments.

Return type:

tuple[Figure, Axes] | None

Returns:

The figure and the axis containing the plot if show=False.

References

[Mus24net] (1,2)

Muschalik, M., Fumagalli, F., Hammer, B., & Hüllermeier, E. (2024). Beyond TreeSHAP: Efficient Computation of Any-Order Shapley Interactions for Tree Ensembles. Proceedings of the AAAI Conference on Artificial Intelligence, 38(13), 14388-14396. https://doi.org/10.1609/aaai.v38i13.29352

[Ing22]

Inglis, A.; Parnell, A.; and Hurley, C. B. 2022. Visualizing Variable Importance and Variable Interaction Effects in Machine Learning Models. Journal of Computational and Graphical Statistics, 31(3): 766-778.