1
$\begingroup$

I am working on a binary classification problem for heart disease prediction.

I have scaled the dataset using Standard Scaler and I am trying to understand the model generated using SHAP values however is there a way to inverse transform the shap values so that I can see which columns affected the prediction?

enter image description here

I tried the below but it didn't work: enter image description here

What I want is something like this: enter image description here

$\endgroup$
2
  • $\begingroup$ Do you want the plots to display column names? $\endgroup$
    – xboard
    Dec 20 '20 at 17:41
  • $\begingroup$ yes, I have edited the question and attached a sample image $\endgroup$
    – Aastha Jha
    Dec 20 '20 at 17:49
1
$\begingroup$

X_test_scaled probably is a numpy array or matrix. You can transform it to a dataframe with column names by doing something like:

df = pd.DataFrame(data=X_test_scaled, columns=["colname1","colname2",...,"colnameX"])

This should be enough for shap.force_plot display the columns names after:

shap.force_plot(explainer.expected_value, shap_values[0,:], df[0,:])
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.