File tree 1 file changed +0
-11
lines changed
1 file changed +0
-11
lines changed Original file line number Diff line number Diff line change @@ -7,23 +7,12 @@ def shapley_value(payoff_matrix):
7
7
if (s & (1 << i )) == 0 : # i not in S
8
8
continue
9
9
10
- < << << << HEAD
11
10
s_without_i = s & ~ (1 << i )
12
11
marginal_contribution = payoff_matrix [s ][i ] - (payoff_matrix [s_without_i ][i ] if s_without_i else 0 )
13
12
shapley_values [i ] += marginal_contribution / (len (bin (s )) - 2 ) # Normalize by size of S
14
- == == == =
15
- S_without_i = S & ~ (1 << i )
16
- marginal_contribution = payoff_matrix [S ][i ] - (
17
- payoff_matrix [S_without_i ][i ] if S_without_i else 0
18
- )
19
- shapley_values [i ] += marginal_contribution / (
20
- len (bin (S )) - 2
21
- ) # Normalize by size of S
22
- >> >> >> > 51 cf80c355f4a1fbfba6aa04bbb0fdf1292dcb2f
23
13
24
14
return shapley_values
25
15
26
-
27
16
# Example usage
28
17
payoff_matrix = np .array ([[1 , 2 ], [3 , 4 ]])
29
18
shapley_vals = shapley_value (payoff_matrix )
You can’t perform that action at this time.
0 commit comments