code: def ndcg(
      correct_duplicates: List, retrieved_duplicates: List
  ) -> float:
      """
      Get Normalized discounted cumulative gain(NDCG) for a single query given correct and retrieved file names.
  
      Args:
          correct_duplicates: List of correct duplicates i.e., ground truth)
          retrieved_duplicates: List of retrieved duplicates for one single query
  
      Returns:
          NDCG for this query.
      """
      if (
          len(retrieved_duplicates) == 0
          and len(correct_duplicates) == 0
      ):
          return 1.0
  
      if not len(retrieved_duplicates) or not len(correct_duplicates):
          return 0.0
  
      def dcg(rel):
          relevance_numerator = [2 ** (k) - 1 for k in rel]
          relevance_denominator = [
              np.log2(k + 2) for k in range(len(rel))
          ]  # first value of denominator term should be 2
  
          dcg_terms = [
              relevance_numerator[k] / relevance_denominator[k]
              for k in range(len(rel))
          ]
          dcg_at_k = np.sum(dcg_terms)
  
          return dcg_at_k
  
      relevance = np.array(
          [
              1 if i in correct_duplicates else 0
              for i in retrieved_duplicates
          ]
      )
      dcg_k = dcg(relevance)
  
      if dcg_k == 0:
          return 0.0
  
      idcg_k = dcg(sorted(relevance, reverse=True))
      return dcg_k / idcg_k
  
imports: from typing import List, Dict
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: ndcg(correct_duplicates, retrieved_duplicates) and returns: unknown, int, int, dcg_at_k, int