fuhsiao commited on
Commit
ffe67a5
·
1 Parent(s): ef27b68
Files changed (1) hide show
  1. utils/methods.py +12 -0
utils/methods.py CHANGED
@@ -60,6 +60,18 @@ def extractive_method(sentJson, sentFeat, model, threshold=0.5, TGB=False):
60
  true_proba[true_proba == np.max(true_proba)] = 1
61
  pred = (true_proba > threshold).astype('int')
62
  return pred, true_proba
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  pred, true_proba = predict(sentFeat)
65
  body = convert_sentence_df(sentJson, pred, true_proba, TGB)
 
60
  true_proba[true_proba == np.max(true_proba)] = 1
61
  pred = (true_proba > threshold).astype('int')
62
  return pred, true_proba
63
+
64
+
65
+ grouped = sentFeat.groupby('section')
66
+ pred = []
67
+ true_proba = []
68
+
69
+ for group_name, group_data in grouped:
70
+ print(group_name)
71
+ pred_sec, true_proba_sec = predict(group_data)
72
+ pred.append(pred_sec)
73
+ true_proba.append(true_proba_sec)
74
+
75
 
76
  pred, true_proba = predict(sentFeat)
77
  body = convert_sentence_df(sentJson, pred, true_proba, TGB)