What is the SHAP values for a linear model?

it is given as below in the documentation

Assuming features are independent leads to interventional SHAP values which for a linear model are coef[i] * (x[i] - X.mean(0)[i]) for the ith feature.

Can someone explain to me how it is derived? Or direct me to a resource explaining the same?.


1 Answer 1


The equation you showed is true only if the features are independent as well. Here is from the help of shap.LinearExplainer:

    elif self.feature_dependence == "independent":
        if len(self.coef.shape) == 1:
            return np.array(X - self.mean) * self.coef
            return [np.array(X - self.mean) * self.coef[i] for i in range(self.coef.shape[0])]

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.