TorchedUp
ProblemsPremium
TorchedUp
ROUGE-LMedium
ProblemsPremium

ROUGE-L

Compute the F1 score of the Longest Common Subsequence between a reference and candidate token list.

Signature: def rouge_l(reference: list, candidate: list) -> float

Steps:

  1. Compute LCS length with O(m*n) dynamic programming.
  2. precision = lcs / len(candidate)
  3. recall = lcs / len(reference)
  4. F1 = 2 * p * r / (p + r)

Return 0.0 if either input is empty or LCS is 0.

Math

Asked at

Python (numpy)0/3 runs today

Test Results

○identical
○subset
○mixed🔒 Premium
Advertisement