shapiq.game_theory.MoebiusConverter¶

class shapiq.game_theory.MoebiusConverter(moebius_coefficients)[source]¶

Bases: object

Computes a variety of game-theoretic concepts exactly from Möbius coefficients.

The MöbiusConverter class is used to compute various game-theoretic concepts like Shapley values, Shapley interactions, Banzhaf interactions, and many more from a collection of Möbius coefficients (also called Möbius Interactions, MI) of a game. The MoebiusConverter is built with the idea that some games

Computes exact Shapley Interactions using the (sparse) Möbius representation. This is much faster than exact computation, if Möbius representation is sparse.

Variables:
  • n – The number of players.

  • moebius_coefficients – The InteractionValues object containing all non-zero (sparse) Möbius coefficients.

Parameters:

moebius_coefficients (InteractionValues)

Initialize the MoebiusConverter.

Parameters:

moebius_coefficients (InteractionValues) – An InteractionValues object containing the (potentially sparse) Möbius coefficients.

__call__(index, order=None)[source]¶

Calls the MoebiusConverter of the specified index or value.

Parameters:
  • index (Literal['k-SII', 'STII', 'FSII', 'FBII', 'SII', 'SV', 'BV']) – The index or value to compute

  • order (int | None) – The order of the interaction index. If not specified the maximum order (i.e. n_players) is used. Defaults to None.

Return type:

InteractionValues

Returns:

The desired interaction values or generalized values.

Raises:

ValueError – If the index is not supported.

compute(index, order)[source]¶

Compute the interaction values for the given index and order.

Parameters:
  • index (Literal['k-SII', 'STII', 'FSII', 'FBII', 'SII', 'SV', 'BV']) – The index or value to compute

  • order (int) – The order of the interaction index.

Return type:

InteractionValues

Returns:

The desired interaction values or generalized values.

valid_indices: tuple[Literal['k-SII', 'STII', 'FSII', 'FBII', 'SII', 'SV', 'BV']] = ('k-SII', 'STII', 'FSII', 'FBII', 'SII', 'SV', 'BV')¶