Skip to content

Commit 1141964

Browse files
authored
Update shapley_value.py
1 parent bd8cd27 commit 1141964

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

game_theory/shapley_value.py

-11
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,12 @@ def shapley_value(payoff_matrix):
77
if (s & (1 << i)) == 0: # i not in S
88
continue
99

10-
<<<<<<< HEAD
1110
s_without_i = s & ~(1 << i)
1211
marginal_contribution = payoff_matrix[s][i] - (payoff_matrix[s_without_i][i] if s_without_i else 0)
1312
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-
>>>>>>> 51cf80c355f4a1fbfba6aa04bbb0fdf1292dcb2f
2313

2414
return shapley_values
2515

26-
2716
# Example usage
2817
payoff_matrix = np.array([[1, 2], [3, 4]])
2918
shapley_vals = shapley_value(payoff_matrix)

0 commit comments

Comments
 (0)