Spaces:
Runtime error
Runtime error
fix plots
Browse files
app.py
CHANGED
@@ -156,12 +156,8 @@ with gr.Blocks() as demo:
|
|
156 |
plt.gca().set_position((0, 0, 1, 1))
|
157 |
plt.title("SHAP Waterfall Plot") # Optionally set a title for the SHAP plot
|
158 |
plt.tight_layout()
|
159 |
-
# plt.xticks(rotation=90)
|
160 |
-
# plt.yticks(rotation=45)
|
161 |
plt.tick_params(axis="y", labelsize=3)
|
162 |
-
shap.waterfall_plot(
|
163 |
-
shap_explanation
|
164 |
-
) # Set show=False to prevent immediate display
|
165 |
|
166 |
fig3 = plt.figure(figsize=(3, 3))
|
167 |
plt.title("SHAP Summary Plot")
|
@@ -171,7 +167,7 @@ with gr.Blocks() as demo:
|
|
171 |
feature_names=["age", "bmi", "hba1c", "glucose"],
|
172 |
)
|
173 |
|
174 |
-
fig4 = plt.figure(figsize=(
|
175 |
feature_importances = rf_classifier.feature_importances_
|
176 |
plt.title("Feature Importances")
|
177 |
sns.barplot(x=feature_importances, y=["age", "bmi", "hba1c", "glucose"])
|
@@ -208,7 +204,14 @@ with gr.Blocks() as demo:
|
|
208 |
existent_info_input,
|
209 |
consent_input,
|
210 |
],
|
211 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
)
|
213 |
|
214 |
demo.launch()
|
|
|
156 |
plt.gca().set_position((0, 0, 1, 1))
|
157 |
plt.title("SHAP Waterfall Plot") # Optionally set a title for the SHAP plot
|
158 |
plt.tight_layout()
|
|
|
|
|
159 |
plt.tick_params(axis="y", labelsize=3)
|
160 |
+
shap.waterfall_plot(shap_explanation)
|
|
|
|
|
161 |
|
162 |
fig3 = plt.figure(figsize=(3, 3))
|
163 |
plt.title("SHAP Summary Plot")
|
|
|
167 |
feature_names=["age", "bmi", "hba1c", "glucose"],
|
168 |
)
|
169 |
|
170 |
+
fig4 = plt.figure(figsize=(4, 3))
|
171 |
feature_importances = rf_classifier.feature_importances_
|
172 |
plt.title("Feature Importances")
|
173 |
sns.barplot(x=feature_importances, y=["age", "bmi", "hba1c", "glucose"])
|
|
|
204 |
existent_info_input,
|
205 |
consent_input,
|
206 |
],
|
207 |
+
outputs=[
|
208 |
+
output,
|
209 |
+
mean_plot,
|
210 |
+
waterfall_plot,
|
211 |
+
summary_plot,
|
212 |
+
importance_plot,
|
213 |
+
decision_plot,
|
214 |
+
],
|
215 |
)
|
216 |
|
217 |
demo.launch()
|