def mrr_score(relevances: List[float], hit_val=1.0) -> float:
  """MRR score computation.

  Args:
    relevances: List[float], The list of relevance scores.
    hit_val: float, The value from which a relevance score is considered a
      'hit'.

  Returns:
    The mean reciprocal rank of the first time the hit_val has been reached in
    the relevances.
  """
  relevances = np.array(relevances)
  if not any(relevances >= hit_val):
    return 0.
  return 1. / (np.argmax(relevances >= hit_val) + 1)
MRR score computation.

  Args:
    relevances: List[float], The list of relevance scores.
    hit_val: float, The value from which a relevance score is considered a
      'hit'.

  Returns:
    The mean reciprocal rank of the first time the hit_val has been reached in
    the relevances.
  
language/search_agents/muzero/utils.py