class_docstr: Calculate the average precision and average precision at n.
docstr: Calculate the non-interpolated average precision.
  
  Args:
    predictions: a numpy 1-D array storing the sparse prediction scores.
    actuals: a numpy 1-D array storing the ground truth labels. Any value
    larger than 0 will be treated as positives, otherwise as negatives.
  
  Returns:
    The non-interpolated average precision at n.
    If n is larger than the length of the ranked list,
    the average precision will be returned.
  
  Raises:
    ValueError: An error occurred when the format of the input is not the
    numpy 1-D array or the shape of predictions and actuals does not match.
docstr_tok: ["Calculate","the","non-interpolated","average","precision",".","Args",":","predictions",":","a","numpy","1-D","array","storing","the","sparse","prediction","scores",".","actuals",":","a","numpy","1-D","array","storing","the","ground","truth","labels",".","Any","value","larger","than","0","will","be","treated","as","positives",",","otherwise","as","negatives",".","Returns",":","The","non-interpolated","average","precision","at","n.","If","n","is","larger","than","the","length","of","the","ranked","list",",","the","average","precision","will","be","returned",".","Raises",":","ValueError",":","An","error","occurred","when","the","format","of","the","input","is","not","the","numpy","1-D","array","or","the","shape","of","predictions","and","actuals","does","not","match","."]
code: def ap(predictions, actuals):
      """Calculate the non-interpolated average precision.
  
      Args:
        predictions: a numpy 1-D array storing the sparse prediction scores.
        actuals: a numpy 1-D array storing the ground truth labels. Any value
        larger than 0 will be treated as positives, otherwise as negatives.
  
      Returns:
        The non-interpolated average precision at n.
        If n is larger than the length of the ranked list,
        the average precision will be returned.
  
      Raises:
        ValueError: An error occurred when the format of the input is not the
        numpy 1-D array or the shape of predictions and actuals does not match.
      """
      return AveragePrecisionCalculator.ap_at_n(
          predictions, actuals, n=None
      )
  
file_path: PaddleHub/modules/video/classification/videotag_tsn_lstm/resource/metrics/youtube8m/average_precision_calculator.py
imports: import heapq
  import random
  import numbers
  import numpy
label_desc: Use image node_id 7 for calling the AveragePrecisionCalculator obj's underlying member method code with example usage: obj.ap(predictions, actuals) and returns: AveragePrecisionCalculator