Relevant code to the "Improving the Weighting Strategy in KernelSHAP" paper by Lars Henry Berge Olsen and Martin Jullum.
There is a three (or four) step procedure to replicate Figure 2 in the paper.
- (Optional) Run the file
Run_model.Rto create the model and compute the true Shapley values. This is very time consuming and the output is saved in therdsfolder. - Run the file
Run_sampling.Rwith the desired number of repetitionsBto generate files that generates and store the sampled coalitions using the different sampling strategies. - Run the file
Run_SV.Rto compute the MAE error between the estimated and true Shapley values for different number of used unique coalitions, and store the results as data tables to disk. - Run the file
Run_plot.Rto load the data tables with the MAE and make the plot.
Note. We have only made the models and true Shapley values available for the M=10 simulation study, as the files are several GBs for the M = 20 setting and it thus not suitable for GitHub.