shap / shap

A game theoretic approach to explain the output of any machine learning model.
https://shap.readthedocs.io
MIT License
22.61k stars 3.26k forks source link

shap_interaction_values - interpretation as difference in SHAP values #2841

Open vla6 opened 1 year ago

vla6 commented 1 year ago

Hi,

I was looking at SHAP interaction values, and this paper:

Consistent Individualized Feature Attribution for Tree Ensembles

I was hoping someone could help me understand section 4 on interaction values better. It says these can be interpreted as "the difference between the SHAP values for feature i when feature j is present and the SHAP values for feature i when feature j is absent".

I understand "present" means fixed to the value for the observation in question, but what does "absent" mean? I usually understand absence in Shapley as being replaced by a random value in the foil dataset. Is this a similar interpretation for feature interactions in SHAP?

If you calculate the Shapley values with and without the feature, you may also have very different overall scores to distribute across the features. Is this correct? The total scores could be very different, for feature j absent vs. present?

I was also wondering if my thinking is right about a tree model where one feature, (j) is very influential. Let's say high values of j always lead to a high model score, but at lower values, other features can modify the risk. For an observation at high j, the feature i has no effect. If j is set to random values, these would be average-ish, and you might go down tree paths where i has some effect. But when you put a large j in, i has essentially zero effect. In that case you have the interaction value of 0 - (effect of feature i when j is average-ish). Is this a correct interpretation?

Thank you very much!

vla6 commented 1 year ago

I have found some information on feature absence for TreeShap in Christoph Molnar's book here.

It appears that an absent feature just follows all possible tree paths, which would lead to sort of average-ish Shapley values if the "absent" feature is dominant.