0
$\begingroup$

I am using Shap Values(the 'shap' module in python) to help me understand a bit better the relation between my features and my target. I am currently working on a binary classification problem. I know that the base line value can be calculated considering the proportion of negative(or positive class) in my training dataset. Also, I know that by default (at least for the algorithms that I've been working with) the shap values given by explainer.shap_values are in log-odds unit and that, in some way, gives a dimension on how impactful the features are in your target prediction.

My question is, considering the shap values "y" (in log-odds or transformed to the probability itself) how can i interpret its value? I mean, Can I say that for one instance/record, the value Z of the X feature incremented the predicted probability of the positive class by y percentual points (or should i say incremented the predicted probability of the positive class by base line value multiplied by y?)

I am missing the part where I can connect the shap values for each instance/feature to a measurable way of saying how impactul that feature value was for a particular instance and how to achieve it. Suppose that for a instance, I have 5 shape values (for each of the 5 features of the model) and the base line is given by a value = 0.2. From that, Is it possible to arrive at the predicted probability or something like what i mentioned above?

Any help or advice would be really helpful. Thank you all!

$\endgroup$

1 Answer 1

1
$\begingroup$

Depending on the explainer and whether feature_dependence="independent", you may be able to get the values in probability space directly with the option model_output="probability".

It can take a lot of "evidence" in (log-odds space) to make a small step in probability space (see explanation here), so you can not directly make your statement. (And it will depend on your use case whether log-odds or probabilities are more appropriate.)

There is no simple way to transform the values "post-explanation" from log-odds space to probability space for individual features. However, you can get to the predicted probability by converting p = np.exp(np.sum(y))/(1.0+np.exp(np.sum(y))) where y are your shap values.

Only in log-odds space is the output additive, so you can say: the value Z of feature X incremented the log-odds by Y.

$\endgroup$
2
  • $\begingroup$ Thank you in first place. Just a small complement: if the model_output="probability" and the base line value is 0.2 and for some feature value, the predicted score goes to 0.3, then the shap value would be 0.1 (the increment from 0.2 to 0.3) or it would be 0.5 (as the predicted score is equal 1.5 * base line) ? $\endgroup$ Dec 30, 2022 at 12:40
  • $\begingroup$ Also, I have tried calculating the '''p = np.exp(np.sum(y))/(1.0+np.exp(np.sum(y)))''' but that is the probability if the model is a logit, right? For tree models i got different scores $\endgroup$ Dec 30, 2022 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.