mertkarabacak
commited on
Commit
•
32b7174
1
Parent(s):
1e532ae
Upload app.py
Browse files
app.py
CHANGED
@@ -163,15 +163,16 @@ def y1_interpret_xgb(*args):
|
|
163 |
df = pd.DataFrame([args], columns=x1.columns)
|
164 |
df = df.astype({col: "category" for col in categorical_columns1})
|
165 |
shap_values = y1_explainer_xgb.shap_values(xgb.DMatrix(df, enable_categorical=True))
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
fig_m.
|
170 |
-
|
171 |
-
plt.
|
172 |
-
plt.
|
173 |
-
plt.
|
174 |
-
|
|
|
175 |
return fig_m
|
176 |
|
177 |
def y1_interpret_lgb(*args):
|
@@ -427,11 +428,11 @@ with gr.Blocks(title = "NTDB-Epidural") as demo:
|
|
427 |
with gr.Row():
|
428 |
|
429 |
gr.Markdown(
|
430 |
-
"""
|
431 |
<br/>
|
|
|
432 |
## Mortality
|
433 |
-
<br/>
|
434 |
"""
|
|
|
435 |
)
|
436 |
|
437 |
with gr.Row():
|
|
|
163 |
df = pd.DataFrame([args], columns=x1.columns)
|
164 |
df = df.astype({col: "category" for col in categorical_columns1})
|
165 |
shap_values = y1_explainer_xgb.shap_values(xgb.DMatrix(df, enable_categorical=True))
|
166 |
+
shap.plots.bar(shap_values[0])
|
167 |
+
fig_m = plt.gcf()
|
168 |
+
ax = plt.gca()
|
169 |
+
fig_m.set_figheight(12)
|
170 |
+
fig_m.set_figwidth(5)
|
171 |
+
plt.xlabel("Mean |SHAP Value|", fontsize =12, fontweight = 'heavy', labelpad = 8)
|
172 |
+
plt.tick_params(axis="y",direction="out", labelsize = 12)
|
173 |
+
plt.tick_params(axis="x",direction="out", labelsize = 12)
|
174 |
+
wrap_labels(ax, 30)
|
175 |
+
ax.figure
|
176 |
return fig_m
|
177 |
|
178 |
def y1_interpret_lgb(*args):
|
|
|
428 |
with gr.Row():
|
429 |
|
430 |
gr.Markdown(
|
|
|
431 |
<br/>
|
432 |
+
"""
|
433 |
## Mortality
|
|
|
434 |
"""
|
435 |
+
<br/>
|
436 |
)
|
437 |
|
438 |
with gr.Row():
|