# How to obtain SHAP values

I want to obtain SHAP values with kernel SHAP without using python but I don't really understand the algorithm. If I have a kNN classifier, do I have to run the classifier for all the coalitions possible? For $$n$$ variables, $$2^n$$ predictions?

Also, how do I obtain the SHAP values after that? Linear regression?

• Hi and welcome to AI SE! What is a SHAP value? Are you referring to values produced by github.com/slundberg/shap? You should contextualize a little bit your problem. – nbro Jun 5 '20 at 14:59
• thank you! yes, I am referring to that. I need to do it in MATLAB but I don't understandit quite well how to obtain those values – sjv Jun 15 '20 at 10:53