def avg_both(mrs, mrrs, hits):
  """Aggregate metrics for left- and right-hand-side predictions.

  Args:
    mrs: Dictionary with mean ranks for lhs and rhs.
    mrrs: Dictionary with mean reciprocical ranks for lhs and rhs.
    hits: Dictionary with hits at 1, 3, 10 for lhs and rhs.

  Returns:
    Dictionary with averaged metrics.
  """
  mr = (mrs['lhs'] + mrs['rhs']) / 2.
  mrr = (mrrs['lhs'] + mrrs['rhs']) / 2.
  h = []
  for k in [1, 3, 10]:
    h += [(hits['lhs'][k] + hits['rhs'][k]) / 2.]
  return {'MR': mr, 'MRR': mrr, 'hits@[1,3,10]': h}