Hellisotherpeople commited on
Commit
c4ccf2e
1 Parent(s): 996905d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -207,6 +207,8 @@ form_explainer.header("Explainer Settings")
207
  position_dep = form_explainer.checkbox("Check this if you want to take into account the position of a word in the interpretation", value = False)
208
  number_samples = form_explainer.number_input("Enter the number of explainer peterbuted samples, higher creates a better explanation but takes longer - you should most likely increase this", value = 200)
209
  char_based = form_explainer.checkbox("Check this if you want to use a character based explanier", value = False)
 
 
210
  form_explainer.form_submit_button("Submit")
211
 
212
 
@@ -254,9 +256,9 @@ if task == "Classification":
254
  target_feature_names = text_clf['clf'].classes_
255
  #target_feature_names = pd.unique(df[labels_column_name])
256
  target_feature_names_list = list(target_feature_names)
257
- t_pred = te.explain_prediction(target_names = target_feature_names_list)
258
  else:
259
- t_pred = te.explain_prediction()
260
  html = format_as_html(t_pred)
261
 
262
  form_html = st.sidebar.form("html_size_form")
 
207
  position_dep = form_explainer.checkbox("Check this if you want to take into account the position of a word in the interpretation", value = False)
208
  number_samples = form_explainer.number_input("Enter the number of explainer peterbuted samples, higher creates a better explanation but takes longer - you should most likely increase this", value = 200)
209
  char_based = form_explainer.checkbox("Check this if you want to use a character based explanier", value = False)
210
+ top_features = form_explainer.number_input("Enter the top number of features we want to show", value = 200)
211
+ top_targets = form_explainer.number_input("Enter the top number of targets we want to show explanations of", value = 5)
212
  form_explainer.form_submit_button("Submit")
213
 
214
 
 
256
  target_feature_names = text_clf['clf'].classes_
257
  #target_feature_names = pd.unique(df[labels_column_name])
258
  target_feature_names_list = list(target_feature_names)
259
+ t_pred = te.explain_prediction(target_names = target_feature_names_list, top = top_features, top_targets = top_targets)
260
  else:
261
+ t_pred = te.explain_prediction(top = top_features, top_targets = top_targets)
262
  html = format_as_html(t_pred)
263
 
264
  form_html = st.sidebar.form("html_size_form")