in sagemaker_notebook_instance/containers/dashboard/src/pages/global_page.py [0:0]
def summary_plot(explanation_group, details, num_features, plot_placeholder):
names = extract_feature_names(explanation_group)
shap_values = [[r['explanation']['shap_values'][e] for e in names] for r in explanation_group]
features = [[r['features'][e] for e in names] for r in explanation_group]
plot_type = 'dot' if details else 'bar'
shap.summary_plot(
shap_values=np.array(shap_values),
features=np.array(features),
feature_names=names,
max_display=num_features,
plot_type=plot_type
)
plot_placeholder.pyplot(bbox_inches='tight')
plt.clf()