|
Algorithm 1 SHAP basic algorithm |
-
1:
Required: M: Number of interactions; x: Instance of interest; j: Features index; X: Data matrix; f: Machine learning model.
-
2:
procedureSHAP()
-
3:
for m=1 in M do
-
4:
Draw random instance z from the data matrix X
-
5:
Choose a random permutation o of the feature values
-
6:
Order instance x:
-
7:
Order instance z:
-
8:
Construct two new instances
-
9:
Compute marginal contribution
-
10:
end for
-
11:
Compute Shapley value as the average
-
12:
end procedure
|