shapiq.plot.upset_plotΒΆ

shapiq.plot.upset_plot(interaction_values, *, n_interactions=20, feature_names=None, color_matrix=False, all_features=True, figsize=None, show=False)[source]ΒΆ

Plots the upset plot.

UpSet plots [Lex14] can be used to visualize the interactions between features. The plot consists of two parts: the upper part shows the interaction values as bars, and the lower part shows the interactions as a matrix. Originally, the UpSet plot was introduced by Lex et al. (2014) [Lex14]. For a more detailed explanation about the plots, see the references or the original [documentation](https://upset.app/).

An example of this plot is shown below.

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

  • feature_names (Sequence[str] | None) – The names of the features. Defaults to None. If None, the features will be named with their index.

  • n_interactions (int) – The number of top interactions to plot. Defaults to 20. Note this number is completely arbitrary and can be adjusted to the user’s needs.

  • color_matrix (bool) – Whether to color the matrix (red for positive values, blue for negative) or not (black). Defaults to False.

  • all_features (bool) – Whether to plot all n_players features or only the features that are present in the top interactions. Defaults to True.

  • figsize (tuple[float, float] | None) – The size of the figure. Defaults to None. If None, the size will be set automatically depending on the number of features.

  • show (bool) – Whether to show the plot. Defaults to False.

Return type:

Figure | None

Returns:

If show is True, the function returns None. Otherwise, it returns a tuple with the figure and the axis of the plot.

References

[Lex14] (1,2)

Alexander Lex, Nils Gehlenborg, Hendrik Strobelt, Romain Vuillemot, Hanspeter Pfister. UpSet: Visualization of Intersecting Sets IEEE Transactions on Visualization and Computer Graphics (InfoVis), 20(12): 1983–1992, doi:10.1109/TVCG.2014.2346248, 2014.