Home > OS >  SHAP Linear model waterfall with Kernel and linear explainer
SHAP Linear model waterfall with Kernel and linear explainer

Time:05-31

I am working on binary classification and trying to explain my model using SHAP framework.

I am using logistic regression algorithm. I would like to explain this model using both KernelExplainer and LinearExplainer.

So, I tried the below code from SO enter image description here

Note: KernelExplainer doesn't support maskers, and in this case either loc or iloc will return the same.

background = Independent(X, max_samples=100)
explainer = LinearExplainer(model,background)
sv = explainer(X.loc[[5]])   # pass the row of interest by index
waterfall(sv[0])

enter image description here

Note here, LinearExplainer's result can be provided to waterfall "as-is"

  • Related