SHAP (Lundberg & Lee, 2017) explains a prediction by splitting it among the input features. The Shapley value of a feature is its average marginal contribution over every order in which features could be revealed, starting from a baseline.
Implement shapley_exact(f, x, baseline), which averages each feature's marginal contribution over all permutations.
For each permutation, reveal features one at a time from the baseline and record how much each one changes the output. Average over permutations.
No results yet
Run your code to check it against the examples, or submit to run every test.