|
20 | 20 |
|
21 | 21 |
|
22 | 22 | class UnanimityGame(Game): |
23 | | - """The Unanimity basis game. |
| 23 | + r"""The Unanimity basis game. |
24 | 24 |
|
25 | 25 | Unanimity games are basis games from cooperative game theory. They are based on a single |
26 | 26 | interaction and return 1 if the coalition contains the interaction and 0 otherwise. |
27 | 27 |
|
28 | | - # TODO(mmshlk): add a reference and a formal description of the Unanimity game |
29 | | - # https://github.com/mmschlk/shapiq/issues/387 |
| 28 | + More formally the Unanimity game is defined based on an interaction :math:`T`, which is a tuple of player indices. |
| 29 | + The cooperative game is defined as follows: |
| 30 | + .. math:: |
| 31 | + :nowrap: |
| 32 | +
|
| 33 | + \begin{eqnarray} |
| 34 | + v(S) & = & 1 if T \\subseteq S \\ |
| 35 | + & = & 0 otherwise |
| 36 | + \\end{eqnarray} |
30 | 37 |
|
31 | 38 | Attributes: |
32 | | - interaction_binary: The interaction encoded in a binary vector of length ``n``. |
| 39 | + interaction_binary: The interaction $T$ encoded in a binary vector of length ``n``. |
33 | 40 | interaction: The interaction encoded as a tuple. |
34 | 41 |
|
35 | 42 | Examples: |
@@ -67,25 +74,37 @@ def value_function(self, coalitions: np.ndarray) -> np.ndarray[float]: |
67 | 74 |
|
68 | 75 |
|
69 | 76 | class SOUM(Game): |
70 | | - """The Sum of Unanimity Game (SOUM) game class. |
| 77 | + r"""The Sum of Unanimity Game (SOUM) game class. |
71 | 78 |
|
72 | 79 | A Sum of Unanimity Game (SOUM) constructs a game based on linear combinations of so-called |
73 | 80 | unanimity games (:class:`~shapiq_games.benchmark.synthetic.soum.UnanimityGame`). |
74 | 81 |
|
75 | | - # TODO(mmshlk): extend description of the SOUM, add a reference and a formal description |
76 | | - # https://github.com/mmschlk/shapiq/issues/387 |
| 82 | + Based on a sequence of Unanimity games :math:`U_1, U_2, \\ldots, U_n` with linear coefficients :math:`c_1, c_2, \\ldots, c_n` |
| 83 | + the SOUM is defined as follows: |
| 84 | + .. math:: |
| 85 | + :nowrap: |
| 86 | + \begin{eqnarray} |
| 87 | + v(S) & = & \\sum_{i=1}^{n} c_i \\cdot v_{U_i}(S) \\ |
| 88 | + v_{U_i}(S) & = & \begin{cases} |
| 89 | + 1 & \text{if } T_i \\subseteq S \\ |
| 90 | + 0 & \text{otherwise} |
| 91 | + \\end{cases} |
| 92 | + \\end{eqnarray} |
| 93 | +
|
| 94 | + where :math:`T_i` is the interaction of the :class:`~shapiq_games.benchmark.synthetic.soum.UnanimityGame` :math:`U_i`. |
| 95 | + The linear coefficients :math:`c_i` are randomly sampled from the interval :math:`[-1, 1]`. |
77 | 96 |
|
78 | 97 | Attributes: |
79 | 98 | n_players: The number of players. |
80 | 99 |
|
81 | | - n_basis_games: The number of Unanimity gams |
| 100 | + n_basis_games: The number of Unanimity games. |
82 | 101 |
|
83 | 102 | unanimity_games: A dictionary containing instances of :class:`~shapiq_games.benchmark.synthetic.soum.UnanimityGame`. |
84 | 103 |
|
85 | 104 | linear_coefficients: A numpy array with coefficients between -1 and 1 for the unanimity |
86 | 105 | games. |
87 | 106 |
|
88 | | - min_interaction_size: The smallest interaction size |
| 107 | + min_interaction_size: The smallest interaction size. |
89 | 108 |
|
90 | 109 | max_interaction_size: The highest interaction size. |
91 | 110 |
|
|
0 commit comments