code: def ndcg(
      relevances: np.ndarray, k: Optional[int] = None
  ) -> np.ndarray:
      """Calculate NDCG (Normalized Discounted Cumulative Gain) at position k.
  
      :param relevances: List of true relevance scores (in the order as they are ranked)
      :type relevances: list
      :param k: Position up to which NDCG is computed
      :type k: int
      :return: The NDCG score at position k
      :rtype: float
      """
      best_dcg = dcg(sorted(relevances, reverse=True), k)
      if best_dcg == 0:
          return 0.0
  
      return dcg(relevances, k) / best_dcg
  
imports: from __future__ import annotations
  from time import time_ns
  from typing import Tuple, Any, Callable, Union, Optional, List
  from dataclasses import dataclass, asdict
  from collections import defaultdict
  from math import ceil
  import numpy
  from usearch.io import load_matrix
  from usearch.index import Index, Matches, BatchMatches, MetricKind, MetricKindBitwise, Key
label_desc: Use image node_id 5 for calling a global function with example usage: ndcg(relevances, k) and returns: unknown, int