code: def calculate_precision_at_equal_recall_rate(predictions, actuals):
      """Performs a local (numpy) calculation of the PERR.
  
      Args:
        predictions: Matrix containing the outputs of the model.
          Dimensions are 'batch' x 'num_classes'.
        actuals: Matrix containing the ground truth labels.
          Dimensions are 'batch' x 'num_classes'.
  
      Returns:
        float: The average precision at equal recall rate across the entire batch.
      """
      aggregated_precision = 0.0
      num_videos = actuals.shape[0]
      for row in numpy.arange(num_videos):
          num_labels = int(numpy.sum(actuals[row]))
          top_indices = numpy.argpartition(
              predictions[row], -num_labels
          )[-num_labels:]
          item_precision = 0.0
          for label_index in top_indices:
              if predictions[row][label_index] > 0:
                  item_precision += actuals[row][label_index]
          item_precision /= top_indices.size
          aggregated_precision += item_precision
      aggregated_precision /= num_videos
      return aggregated_precision
  
file_path: PaddleHub/modules/video/classification/videotag_tsn_lstm/resource/metrics/youtube8m/eval_util.py
imports: import datetime
  import numpy
  from .None import mean_average_precision_calculator
  from .None import average_precision_calculator
label_desc: Use image node_id 3 for calling a global function with example usage: calculate_precision_at_equal_recall_rate(predictions, actuals) and returns: aggregated_precision