Hi! I have a question regarding SHAP-values. I trained a neural network predicting a score (regression) and want to derive the variable importance using SHAP-values. My model was trained on scaled (normalized) input features. Now my question is: when I calculate the SHAP-values, do my input features also have to be normalized? Or is it allowed to use the original inputs? I tried both approaches - once with normalized inputs and once with the original inputs. Interestingly, from a logical and practical standpoint, the importance makes much more sense when using the non-normalized variables.

The code I used is:
explainer = shap.Explainer(model.predict, X_t_scaled)
shap_values = explainer(X_t_scaled)

Looking forward for any advise! Thanks and best regards!

Thanks for the help! When using your provided code I get the following error message: UserWarning: Your TensorFlow version is newer than 2.4.0 and so graph support has been removed in eager mode and some static graphs may not be supported. See PR #1483 for discussion. warnings.warn(“Your TensorFlow version is newer than 2.4.0 and so graph support has been removed in eager mode and some static graphs may not be supported. See PR #1483 for discussion.”)