IanRonk commited on
Commit
7deafbb
1 Parent(s): 99542fe

Update the threshold with variance and mean

Browse files
Files changed (1) hide show
  1. functions/model_infer.py +5 -2
functions/model_infer.py CHANGED
@@ -37,6 +37,9 @@ def preprocess(sentences):
37
  def predict_from_document(sentences):
38
  preprop = preprocess(sentences)
39
  prediction = model.predict(preprop)
40
- # Set the prediction threshold to 0.8
41
- output = (prediction.flatten()[: len(sentences)] >= 0.85).astype(int)
 
 
 
42
  return output, prediction.flatten()[: len(sentences)]
 
37
  def predict_from_document(sentences):
38
  preprop = preprocess(sentences)
39
  prediction = model.predict(preprop)
40
+ # Set the prediction threshold to 0.8 instead of 0.5, now use mean
41
+ output = (
42
+ prediction.flatten()[: len(sentences)]
43
+ >= np.mean(prediction) + np.var(prediction) * 2
44
+ ).astype(int)
45
  return output, prediction.flatten()[: len(sentences)]