mertkarabacak commited on
Commit
d222e13
1 Parent(s): ea471c6

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -176,15 +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
- 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)
 
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_y1 = shap.bar_plot(shap_values[0], max_display = 10, show = False, feature_names = x1.columns)
180
+ fig_y1 = plt.gcf()
181
+ ax_y1 = plt.gca()
182
+ fig_y1.set_figheight(6)
183
+ fig_y1.set_figwidth(10)
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_y1
188
 
189
  def y1_interpret_lgb(*args):
190
  df = pd.DataFrame([args], columns=x1_lgb.columns)