code: def get_performance(user_pos_test, r, auc, Ks):
      precision, recall, ndcg, hit_ratio = [], [], [], []
  
      for K in Ks:
          precision.append(metrics.precision_at_k(r, K))
          recall.append(metrics.recall_at_k(r, K, len(user_pos_test)))
          ndcg.append(metrics.ndcg_at_k(r, K))
          hit_ratio.append(metrics.hit_at_k(r, K))
  
      return {
          "recall": np.array(recall),
          "precision": np.array(precision),
          "ndcg": np.array(ndcg),
          "hit_ratio": np.array(hit_ratio),
          "auc": 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 4 for calling a global function with example usage: get_performance(user_pos_test, r, auc, Ks) and returns: dict