# Determining SHAP values for combined features

Say I have a dataset with three features: X1, X2 and X1 + X2. How would I determine the SHAP values for just singular features?

I'll denote I denote the SHAP value of say X1 as SHAP(X1). Would it be correct in saying that the true SHAP value of X1 is SHAP(X1 + X2) - SHAP(X2) due to SHAP values being linear? Is this mathematically sound? What about for more complicated features like X1/SQRT(X1 + X2 + X3)? If I train a model on this dataset then how accurate would these SHAP values even be?

I'll try to answer in parts:

On SHAP values being linear:

SHAP values are calculated based on the marginal contribution of a given feature to the prediction, considering all possible combinations of features. Therefore, if you have combined features (such as X1 + X2) in your dataset, their contributions can't necessarily be easily separated, so you can't really state that SHAP(X1) = SHAP(X1 + X2) - SHAP(X2). Stating that SHAP(X1) = SHAP(X1 + X2) - SHAP(X2) wouldn't be mathematically sound as it oversimplifies the interdependencies between features.

On complex features such as X1/SQRT(X1 + X2 + X3):

This kind of complex feature makes the SHAP values harder to interpret indeed. The value would be influenced by the feature's interactions with other features and how these affect the output of the model. Compared to singular, independent features, it would indeed be a lot harder to interpret the SHAP value, and you might be better off using a different approach to try to interpret a model's predictions and the features' contributions.

On how accurate would the SHAP values be:

Ultimately, it will depend on the model complexity and nature of your data. For simpler models and features that are not very correlated (like your initial example of X1, X2 and X1+X2), SHAP can be a good tool to provide intuitive and reliable explanations for the predictions. The more complex the model becomes, and the more complex the relationship between features, or the more correlated they are, the less clear the explanations provided by SHAP will be, and they might not be a good idea.

Conclusion

Whatever you are using, SHAP included, make sure you understand how it applies to your specific case, use more than one approach and evaluate it in context. SHAP values provide a local explanation (contained to individual predictions) rather than a global understanding of feature importance in your model, and the more complex the model and the feature interdependencies become, the less reliable they are and the trickier they will be to interpret.

And performing direct arithmetic operations on the SHAP values, even when the relationship between features is purely linear, will lead to oversimplified interpretations, which can also be quite misleading.