def _record_recall_metrics(self,
                             *,
                             ranked_evidence,
                             epoch,
                             scrape_type,
                             logs = None):
    """Compute and record recall metrics.

    Args:
      ranked_evidence: Grouped and sorted evidence
      epoch: Current epoch
      scrape_type: The source scrape type to log metrics with
      logs: logs dictionary
    """
    if self._debug:
      metrics = {
          'val_recall_1': 0,
      }
      for name, value in metrics.items():
        if logs is not None:
          logs[name] = value
      return
    recall_positions = model_recall_by_position(
        self._verifiable_dev, ranked_evidence)
    recall_metrics = {}
    for idx in range(1, self._max_recall_n + 1):
      total = sum(1.0 for n in recall_positions if n <= idx)
      recall_metrics[idx] = total / len(recall_positions)
    for idx in range(1, 11):
      if idx in recall_metrics:
        metric_name = f'val_recall_{scrape_type}_{idx}'
        if logs is not None:
          logs[metric_name] = recall_metrics[idx]
        logging.info(
            'epoch %s: %s=%s',
            epoch, metric_name, recall_metrics[idx])
Compute and record recall metrics.

    Args:
      ranked_evidence: Grouped and sorted evidence
      epoch: Current epoch
      scrape_type: The source scrape type to log metrics with
      logs: logs dictionary
    
language/serene/callbacks.py