code: def get_auc(item_score, user_pos_test):
      item_score = sorted(item_score.items(), key=lambda kv: kv[1])
      item_score.reverse()
      item_sort = [x[0] for x in item_score]
      posterior = [x[1] for x in item_score]
  
      r = []
      for i in item_sort:
          if i in user_pos_test:
              r.append(1)
          else:
              r.append(0)
      auc = metrics.auc(ground_truth=r, prediction=posterior)
      return auc
  
file_path: dgl/examples/pytorch/NGCF/NGCF/utility/batch_test.py
imports: import heapq
  import multiprocessing
  import utility.metrics
  from utility.load_data import *
  from utility.parser import parse_args
label_desc: Use image node_id 2 for calling a global function with example usage: get_auc(item_score, user_pos_test) and returns: auc