code: def mean_average_precision(rs):
      """Score is mean average precision
      Relevance is binary (nonzero is relevant).
      Returns:
          Mean average precision
      """
      return np.mean([average_precision(r) for r in rs])
  
file_path: dgl/examples/pytorch/NGCF/NGCF/utility/metrics.py
imports: import numpy
  from sklearn.metrics import roc_auc_score
label_desc: Use image node_id 4 for calling a global function with example usage: mean_average_precision(rs) and returns: np