Calculating Shapley Values

  • p!: The total number of possible permutations (or orderings) of these variables.
  • J: A possible permutation of the set of explanatory variables {1,2,,p} included in the model f().
  • π(J,j): Set of the indices of the variables that are positioned in J before the j-th variable.
  • Δj|π(J,j)(x_): The variable-importance measure of j due the variables that have been used before (constant for all permutations J)

Average of the variable-importance measures across all possible orderings of explanatory variables

φ(x_,j)=1p!JΔj|π(J,j)(x_)

For a large p we can use Monte Carlo estimator