code: def mean_average_precision(ranking):
      """
      Score is mean average precision. Relevance is binary (nonzero is relevant).
  
      :param ranking: Relevance scores (list or numpy) in rank order (first element is the first item)
      :type ranking: list, np.array
  
      :return: Mean average precision
      :rtype: float
      """
  
      return np.mean([average_precision(r) for r in ranking])
  
imports: import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: mean_average_precision(ranking) and returns: np