primeqa.mrc.metrics.tydi_f1.eval_utils.compute_partial_match_scores#

primeqa.mrc.metrics.tydi_f1.eval_utils.compute_partial_match_scores(gold_span, pred_span)#

Compute byte indices precision, recall and F1 score between span a and b.

This is used for scoring only minimal answers. See nonnull_span_equal for scoring passage answers.

Parameters
  • gold_span – a Span object. End_byte is inclusive (start_byte+byte_len)

  • pred_span – a Span object. Only compare non-null spans. Then, if the bytes are ot negative, compare byte offsets.

Returns

byte offset based precision.

(# bytes in both gold and pred span) / (# bytes in pred_span)

recall: byte offset based recall.

(# bytes in both gold and pred span) / (# bytes in gold_span)

f1: harmonic mean of precision and recall.

Return type

precision