Skip to content

Instantly share code, notes, and snippets.

@aswalin
Created June 10, 2019 04:11
Show Gist options
  • Save aswalin/c0c836a0006d6e2343d38a5a4c2abb8e to your computer and use it in GitHub Desktop.
Save aswalin/c0c836a0006d6e2343d38a5a4c2abb8e to your computer and use it in GitHub Desktop.
shap
shap_values = model.get_feature_importance(Pool(X_test, label=y_test,cat_features=categorical_features_indices),
type="ShapValues")
expected_value = shap_values[0,-1]
shap_values = shap_values[:,:-1]
shap.initjs()
shap.force_plot(expected_value, shap_values[3,:], X_test.iloc[3,:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment