Skip to main content
. 2022 Nov 25;22(23):9184. doi: 10.3390/s22239184
Algorithm 1: SHAP Tree Model Shapley Value Calculation Pseudo-Code Efx|xS.
Inputs: x,S,tree={v,a,b,t,r,d}
Process:
1: if vj does not belong to an internal node, then
2:  return w*vj
3: elseif
4:  if djS, then
5:    if xdjtj
6:      return Gaj,w
7:    else return Gbj,w
9:    endif
8:  else return Gaj,wraj/rj+Gbj,wrbj/rj
9:   endif
10: endif
Output: Gj,w