in scripts/adapet/ADAPET/src/eval/Scorer.py [0:0]
def _compute_acc(self):
'''
:return:
'''
acc_cor_cnt = 0
acc_ttl_cnt = 0
if self.is_multirc:
for (idx, pred_true_lbl) in self.dict_idx2logits_lbl.items():
exact_match = True
for (pred_lbl, true_lbl, _) in pred_true_lbl:
if pred_lbl != true_lbl:
exact_match = False
if exact_match:
acc_cor_cnt += 1
acc_ttl_cnt += 1
else:
for (idx, pred_true_lbl) in self.dict_idx2logits_lbl.items():
pred_lbl = pred_true_lbl[0][0]
true_lbl = pred_true_lbl[0][1]
acc_ttl_cnt += 1
if pred_lbl == true_lbl:
acc_cor_cnt += 1
round_tot_acc = float(round(acc_cor_cnt / acc_ttl_cnt, 3))
return round_tot_acc