Skip to content

Instantly share code, notes, and snippets.

@rkdgusrn1212
Created May 30, 2022 18:02
Show Gist options
  • Save rkdgusrn1212/61fccfec23d940fff2bae32eb9d35037 to your computer and use it in GitHub Desktop.
Save rkdgusrn1212/61fccfec23d940fff2bae32eb9d35037 to your computer and use it in GitHub Desktop.
SHAP Summary Plot
import shap # package used to calculate Shap values
#tree or deep or kernel
explainer = shap.TreeExplainer(my_model)
shap_values = explainer.shap_values(val_X)#전체 record에 대한 shap 값들이 필요하다.
shap.summary_plot(shap_values[1], val_X)#shap_values[1]는 regression에서 possitive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment