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.
- Parameters:
interaction_values (
InteractionValues) β The interaction values as anInteractionValuesobject.feature_names (
Sequence[str] |None) β The names of the features. Defaults toNone. IfNone, the features will be named with their index.n_interactions (
int) β The number of top interactions to plot. Defaults to20. 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 toFalse.all_features (
bool) β Whether to plot alln_playersfeatures or only the features that are present in the top interactions. Defaults toTrue.figsize (
tuple[float,float] |None) β The size of the figure. Defaults toNone. IfNone, the size will be set automatically depending on the number of features.show (
bool) β Whether to show the plot. Defaults toFalse.
- Return type:
- Returns:
If
showisTrue, the function returnsNone. Otherwise, it returns a tuple with the figure and the axis of the plot.
References