ajit commited on
Commit
d180d0a
1 Parent(s): 42f5687

Debug prints

Browse files
Files changed (1) hide show
  1. aggregate_server_json.py +7 -3
aggregate_server_json.py CHANGED
@@ -204,13 +204,15 @@ class AggregateNER:
204
  mean_score = 0
205
  #sum_deviation = 0
206
  #for node in dist:
207
- # sum_deviation += (mean_score - node["confidence"])*(mean_score - node["confidence"])
208
  #variance = sum_deviation/len(dist)
209
  #std_dev = math.sqrt(variance)
210
- #threshold = mean_score + std_dev*self.threshold #default is 1 standard deviation from mean
211
- threshold = mean_score
 
212
  pick_count = 1
213
  for node in dist:
 
214
  if (node["confidence"] >= threshold):
215
  ret_arr.append({"e":node["e"],"conf":node["confidence"]})
216
  pick_count += 1
@@ -292,8 +294,10 @@ class AggregateNER:
292
  #here cs and ci are same. So use two consecutive cs predictions if meaningful
293
  if (len(results[server_index]["orig_cs_prediction_details"][pivot_index]['cs_distribution']) >= 2):
294
  ret_arr = self.get_predictions_above_threshold(results[server_index]["orig_cs_prediction_details"][pivot_index])
 
295
  orig_cs_second_entity = results[server_index]["orig_cs_prediction_details"][pivot_index]['cs_distribution'][1]
296
  m2_cs = orig_cs_second_entity["e"].split('[')[0]
 
297
  is_cs_included = True if (m2_cs in servers_arr[server_index]["precedence"]) else False
298
  is_cs_included = True #Disabling cs included check. If prediction above threshold is cross prediction, then letting it through
299
  assert (m2_cs != m1)
 
204
  mean_score = 0
205
  #sum_deviation = 0
206
  #for node in dist:
207
+ # sum_deviation += (mean_score - node["confidence"])*(mean_score - node["confidence"])
208
  #variance = sum_deviation/len(dist)
209
  #std_dev = math.sqrt(variance)
210
+ #print("mean",mean,"std_dev",std_dev)
211
+ #threshold = mean_score - std_dev*self.threshold #default is 1 standard deviation from mean
212
+ threshold = mean_score
213
  pick_count = 1
214
  for node in dist:
215
+ print("conf:",node["confidence"],"threshold:",threshold)
216
  if (node["confidence"] >= threshold):
217
  ret_arr.append({"e":node["e"],"conf":node["confidence"]})
218
  pick_count += 1
 
294
  #here cs and ci are same. So use two consecutive cs predictions if meaningful
295
  if (len(results[server_index]["orig_cs_prediction_details"][pivot_index]['cs_distribution']) >= 2):
296
  ret_arr = self.get_predictions_above_threshold(results[server_index]["orig_cs_prediction_details"][pivot_index])
297
+ print("orig cs:",results[server_index]["orig_cs_prediction_details"][pivot_index]['cs_distribution'])
298
  orig_cs_second_entity = results[server_index]["orig_cs_prediction_details"][pivot_index]['cs_distribution'][1]
299
  m2_cs = orig_cs_second_entity["e"].split('[')[0]
300
+ print("m2_cs",m2_cs,"ret_arr",ret_arr)
301
  is_cs_included = True if (m2_cs in servers_arr[server_index]["precedence"]) else False
302
  is_cs_included = True #Disabling cs included check. If prediction above threshold is cross prediction, then letting it through
303
  assert (m2_cs != m1)