MCPcopy Create free account
hub / github.com/OrangeInSouth/DeePEn / evaluate_predictions_impl

Function evaluate_predictions_impl

utils/evaluate/utils/eval_utils.py:75–93  ·  view source on GitHub ↗

Calculates and returns metrics.

(references,
                              predictions,
                              is_regex)

Source from the content-addressed store, hash-verified

73
74
75def evaluate_predictions_impl(references,
76 predictions,
77 is_regex):
78 """Calculates and returns metrics."""
79 missing_predictions = 0
80 correct = 0
81 for question, answer in references.items():
82 if question in predictions:
83 # pdb.set_trace()
84 correct += int(
85 is_correct(answers=answer, prediction=predictions[question], is_regex=is_regex))
86 else:
87 missing_predictions += 1
88
89 return dict( # pytype: disable=bad-return-type # dict-kwargs
90 missing_predictions=missing_predictions,
91 num_correct=correct,
92 num_total=len(references),
93 accuracy=correct / float(len(references)))
94
95
96def find_last_uppercase_abcd(s):

Callers 1

evaluate_predictionsFunction · 0.85

Calls 1

is_correctFunction · 0.70

Tested by

no test coverage detected