code: def ndcg_at_k(r, k, method=1):
      """Score is normalized discounted cumulative gain (ndcg)
      Relevance is positive real values.  Can use binary
      as the previous methods.
      Returns:
          Normalized discounted cumulative gain
      """
      dcg_max = dcg_at_k(sorted(r, reverse=True), k, method)
      if not dcg_max:
          return 0.0
      return dcg_at_k(r, k, method) / dcg_max
  
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 6 for calling a global function with example usage: ndcg_at_k(r, k, method) and returns: unknown, int