code: def ndcg_at_k(ranking):
      """
      Score is normalized discounted cumulative gain (ndcg). Relevance is positive real values.  Can use binary
      as the previous methods.
  
      :param ranking: ranking to evaluate in dcg format [0, 0, 1], where 1 is correct info
      :type ranking: list
  
      :return: Normalized discounted cumulative gain
      :rtype: float
  
      """
  
      ranking = np.asfarray(ranking)
      r_ideal = np.asfarray(sorted(ranking, reverse=True))
      dcg_ideal = r_ideal[0] + np.sum(
          r_ideal[1:] / np.log2(np.arange(2, r_ideal.size + 1))
      )
      dcg_ranking = ranking[0] + np.sum(
          ranking[1:] / np.log2(np.arange(2, ranking.size + 1))
      )
  
      return dcg_ranking / dcg_ideal
  
imports: import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: ndcg_at_k(ranking) and returns: unknown