What is the SHAP values for a liner model? How do we derive that?

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?.

Topic linear-models shap explainable-ai machine-learning

Category Data Science


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
        else:
            return [np.array(X - self.mean) * self.coef[i] for i in range(self.coef.shape[0])]

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.