original_docstring: 
      Function to evaluate the Discounted Cumulative Gain @ k for a given
      ground truth vector and a list of predictions (between 0 and 1).
  
      Args:
          ground_truth : np.array consisting of multi-hot encoding of label
                         vector
          predictions : np.array consisting of predictive probabilities for
                        every label.
          k : Value of k. Default: 5
          pos_label : Value to consider as positive. Default: 1
  
      Returns:
          NDCG @ k for a given ground truth - prediction pair.
      
docstring: Function to evaluate the Discounted Cumulative Gain @ k for a given
  ground truth vector and a list of predictions (between 0 and 1).
docstring_tokens: Function to evaluate the Discounted Cumulative Gain @ k for a given ground truth vector and a list of predictions ( between 0 and 1 ) .
code: def ndcg_score_at_k(ground_truth, predictions, k=5, pos_label=1, device='cpu'):
      """
      Function to evaluate the Discounted Cumulative Gain @ k for a given
      ground truth vector and a list of predictions (between 0 and 1).
  
      Args:
          ground_truth : np.array consisting of multi-hot encoding of label
                         vector
          predictions : np.array consisting of predictive probabilities for
                        every label.
          k : Value of k. Default: 5
          pos_label : Value to consider as positive. Default: 1
  
      Returns:
          NDCG @ k for a given ground truth - prediction pair.
      """
      dcg_at_k = dcg_score_at_k(ground_truth, predictions, k, pos_label, device)
      best_dcg_at_k = dcg_score_at_k(ground_truth, ground_truth, k, pos_label, device)
      dcg_at_k[(best_dcg_at_k == 0).nonzero()] = 0
      best_dcg_at_k[(best_dcg_at_k == 0).nonzero()] = 1
      #if best_dcg_at_k == 0:
      #    return 0
      #else:
      return torch.div(dcg_at_k, best_dcg_at_k).sum()
code_tokens: def ndcg_score_at_k ( ground_truth , predictions , k = 5 , pos_label = 1 , device = 'cpu' ) : dcg_at_k = dcg_score_at_k ( ground_truth , predictions , k , pos_label , device ) best_dcg_at_k = dcg_score_at_k ( ground_truth , ground_truth , k , pos_label , device ) dcg_at_k [ ( best_dcg_at_k == 0 ) . nonzero ( ) ] = 0 best_dcg_at_k [ ( best_dcg_at_k == 0 ) . nonzero ( ) ] = 1 return torch . div ( dcg_at_k , best_dcg_at_k ) . sum ( )
short_docstring: Function to evaluate the Discounted Cumulative Gain @ k for a given
  ground truth vector and a list of predictions (between 0 and 1).
short_docstring_tokens: Function to evaluate the Discounted Cumulative Gain @ k for a given ground truth vector and a list of predictions ( between 0 and 1 ) .
comment: """
      Function to evaluate the Discounted Cumulative Gain @ k for a given
      ground truth vector and a list of predictions (between 0 and 1).
  
      Args:
          ground_truth : np.array consisting of multi-hot encoding of label
                         vector
          predictions : np.array consisting of predictive probabilities for
                        every label.
          k : Value of k. Default: 5
          pos_label : Value to consider as positive. Default: 1
  
      Returns:
          NDCG @ k for a given ground truth - prediction pair.
      """$SEP$#if best_dcg_at_k == 0:$SEP$#    return 0$SEP$#else: