mertkarabacak commited on
Commit
2d99f73
1 Parent(s): 2ec1d6c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -193,15 +193,15 @@ def y1_interpret_xgb(*args):
193
  df = pd.DataFrame([args], columns=x1.columns)
194
  df = df.astype({col: "category" for col in categorical_columns1})
195
  shap_values = y1_explainer_xgb.shap_values(xgb.DMatrix(df, enable_categorical=True))
196
- fig_y1 = shap.bar_plot(shap_values[0], max_display = 10, show = False, feature_names = f_names)
197
  fig_y1 = plt.gcf()
198
  fig_y1.set_figheight(6)
199
- fig_y1.set_figwidth(6)
200
  ax_y1 = plt.gca()
 
201
  plt.xlabel("SHAP value (impact on model output)", fontsize =12, fontweight = 'heavy', labelpad = 8)
202
  plt.tick_params(axis="y",direction="out", labelsize = 12)
203
  plt.tick_params(axis="x",direction="out", labelsize = 12)
204
- plt.tight_layout()
205
  wrap_labels(ax_y1, 30)
206
  ax_y1.figure
207
  return fig_y1
 
193
  df = pd.DataFrame([args], columns=x1.columns)
194
  df = df.astype({col: "category" for col in categorical_columns1})
195
  shap_values = y1_explainer_xgb.shap_values(xgb.DMatrix(df, enable_categorical=True))
196
+ shap.bar_plot(shap_values[0], max_display = 10, show = False, feature_names = f_names)
197
  fig_y1 = plt.gcf()
198
  fig_y1.set_figheight(6)
199
+ fig_y1.set_figwidth(8)
200
  ax_y1 = plt.gca()
201
+ plt.tight_layout()
202
  plt.xlabel("SHAP value (impact on model output)", fontsize =12, fontweight = 'heavy', labelpad = 8)
203
  plt.tick_params(axis="y",direction="out", labelsize = 12)
204
  plt.tick_params(axis="x",direction="out", labelsize = 12)
 
205
  wrap_labels(ax_y1, 30)
206
  ax_y1.figure
207
  return fig_y1