Spaces:
Runtime error
Runtime error
add interaction plot
Browse files
app.py
CHANGED
@@ -67,7 +67,7 @@ with gr.Blocks() as demo:
|
|
67 |
summary_plot = gr.Plot()
|
68 |
with gr.Row():
|
69 |
with gr.Column():
|
70 |
-
|
71 |
with gr.Column():
|
72 |
plottttttt = gr.Plot()
|
73 |
|
@@ -163,11 +163,21 @@ with gr.Blocks() as demo:
|
|
163 |
) # Set show=False to prevent immediate display
|
164 |
|
165 |
fig3 = plt.figure(figsize=(3, 3))
|
|
|
166 |
shap.summary_plot(
|
167 |
shap_values,
|
168 |
features=transformed_df,
|
169 |
feature_names=["age", "bmi", "hba1c", "glucose"],
|
170 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
## save user's data in hopsworks
|
172 |
if consent_input == True:
|
173 |
user_data_fg = fs.get_or_create_feature_group(
|
@@ -180,7 +190,7 @@ with gr.Blocks() as demo:
|
|
180 |
user_data_df["diabetes"] = existent_info_input
|
181 |
user_data_fg.insert(user_data_df)
|
182 |
print("inserted new user data to hopsworks", user_data_df)
|
183 |
-
return res, fig, fig2, fig3
|
184 |
|
185 |
btn.click(
|
186 |
submit_inputs,
|
|
|
67 |
summary_plot = gr.Plot()
|
68 |
with gr.Row():
|
69 |
with gr.Column():
|
70 |
+
interaction_plot = gr.Plot()
|
71 |
with gr.Column():
|
72 |
plottttttt = gr.Plot()
|
73 |
|
|
|
163 |
) # Set show=False to prevent immediate display
|
164 |
|
165 |
fig3 = plt.figure(figsize=(3, 3))
|
166 |
+
plt.title("SHAP Summary Plot")
|
167 |
shap.summary_plot(
|
168 |
shap_values,
|
169 |
features=transformed_df,
|
170 |
feature_names=["age", "bmi", "hba1c", "glucose"],
|
171 |
)
|
172 |
+
|
173 |
+
fig4 = plt.figure(figsize=(3, 3))
|
174 |
+
plt.title("SHAP Interaction Plot")
|
175 |
+
shap_interaction_values = explainer.shap_interaction_values(transformed_df)
|
176 |
+
shap.summary_plot(
|
177 |
+
shap_interaction_values,
|
178 |
+
features=transformed_df,
|
179 |
+
feature_names=["age", "bmi", "hba1c", "glucose"],
|
180 |
+
)
|
181 |
## save user's data in hopsworks
|
182 |
if consent_input == True:
|
183 |
user_data_fg = fs.get_or_create_feature_group(
|
|
|
190 |
user_data_df["diabetes"] = existent_info_input
|
191 |
user_data_fg.insert(user_data_df)
|
192 |
print("inserted new user data to hopsworks", user_data_df)
|
193 |
+
return res, fig, fig2, fig3, fig4
|
194 |
|
195 |
btn.click(
|
196 |
submit_inputs,
|