mertkarabacak
commited on
Commit
•
ea471c6
1
Parent(s):
596ab4a
Upload app.py
Browse files
app.py
CHANGED
@@ -176,7 +176,15 @@ def y1_interpret_xgb(*args):
|
|
176 |
df = pd.DataFrame([args], columns=x1.columns)
|
177 |
df = df.astype({col: "category" for col in categorical_columns1})
|
178 |
shap_values = y1_explainer_xgb.shap_values(xgb.DMatrix(df, enable_categorical=True))
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
|
181 |
def y1_interpret_lgb(*args):
|
182 |
df = pd.DataFrame([args], columns=x1_lgb.columns)
|
|
|
176 |
df = pd.DataFrame([args], columns=x1.columns)
|
177 |
df = df.astype({col: "category" for col in categorical_columns1})
|
178 |
shap_values = y1_explainer_xgb.shap_values(xgb.DMatrix(df, enable_categorical=True))
|
179 |
+
fig_m = shap.bar_plot(shap_values[0], max_display = 10, show = False)
|
180 |
+
fig_m = plt.gcf()
|
181 |
+
ax_m = plt.gca()
|
182 |
+
fig_m.set_figheight(6)
|
183 |
+
fig_m.set_figwidth(6)
|
184 |
+
plt.xlabel("SHAP value (impact on model output)", fontsize =12, fontweight = 'heavy', labelpad = 8)
|
185 |
+
plt.tick_params(axis="y",direction="out", labelsize = 12)
|
186 |
+
plt.tick_params(axis="x",direction="out", labelsize = 12)
|
187 |
+
return fig_m
|
188 |
|
189 |
def y1_interpret_lgb(*args):
|
190 |
df = pd.DataFrame([args], columns=x1_lgb.columns)
|