def forward(self, batch_hypothesis_ids: List[np.ndarray], batch_reference_id: List[int]) -> float:
    'Score the mean reciprocal rank for the batch\n            \n            Example from http://en.wikipedia.org/wiki/Mean_reciprocal_rank\n            \n            >>> batch_hypothesis_ids = [[1, 0, 2], [0, 2, 1], [1, 0, 2]]\n            >>> batch_reference_id = [2, 2, 1]\n            >>> mrr = MRR()\n            >>> mrr(batch_hypothesis_ids, batch_reference_id)\n                0.61111111111111105\n\n            Args:\n                batch_hypothesis_ids: Batch of hypothesis ids (as numpy array) ordered by its relevance\n                reference_id: Batch of reference id (as a integer) of the correct id of response\n            Returns:\n                Mean reciprocal rank (MRR)\n        '
    assert (len(batch_hypothesis_ids) == len(batch_reference_id)), 'Hypothesis batch and reference batch must have same length.'
    batch_size = len(batch_hypothesis_ids)
    mrr = 0
    for (hypothesis_ids, reference_id) in zip(batch_hypothesis_ids, batch_reference_id):
        reciprocal_rank = self._calculate_reciprocal_rank(hypothesis_ids, reference_id)
        mrr += (reciprocal_rank / batch_size)
    return mrr
Score the mean reciprocal rank for the batch

Example from http://en.wikipedia.org/wiki/Mean_reciprocal_rank

>>> batch_hypothesis_ids = [[1, 0, 2], [0, 2, 1], [1, 0, 2]]
>>> batch_reference_id = [2, 2, 1]
>>> mrr = MRR()
>>> mrr(batch_hypothesis_ids, batch_reference_id)
    0.61111111111111105

Args:
    batch_hypothesis_ids: Batch of hypothesis ids (as numpy array) ordered by its relevance
    reference_id: Batch of reference id (as a integer) of the correct id of response
Returns:
    Mean reciprocal rank (MRR)
def forward(self, batch_hypothesis_ids: List[np.ndarray], batch_reference_id: List[int]) -> float:
    'Score the mean reciprocal rank for the batch\n            \n            Example from http://en.wikipedia.org/wiki/Mean_reciprocal_rank\n            \n            >>> batch_hypothesis_ids = [[1, 0, 2], [0, 2, 1], [1, 0, 2]]\n            >>> batch_reference_id = [2, 2, 1]\n            >>> mrr = MRR()\n            >>> mrr(batch_hypothesis_ids, batch_reference_id)\n                0.61111111111111105\n\n            Args:\n                batch_hypothesis_ids: Batch of hypothesis ids (as numpy array) ordered by its relevance\n                reference_id: Batch of reference id (as a integer) of the correct id of response\n            Returns:\n                Mean reciprocal rank (MRR)\n        '
    assert (len(batch_hypothesis_ids) == len(batch_reference_id)), 'Hypothesis batch and reference batch must have same length.'
    batch_size = len(batch_hypothesis_ids)
    mrr = 0
    for (hypothesis_ids, reference_id) in zip(batch_hypothesis_ids, batch_reference_id):
        reciprocal_rank = self._calculate_reciprocal_rank(hypothesis_ids, reference_id)
        mrr += (reciprocal_rank / batch_size)
    return mrr