class_docstr: Computes NDCG (normalized discounted cumulative gain).
class_docstr_tok: ["Computes","NDCG","(","normalized","discounted","cumulative","gain",")","."]
code: def _query(
      self, element: metric_types.StandardMetricInputs
  ) -> Union[float, int, str]:
      query = util.get_by_keys(
          element.combined_features, [self._query_key]
      ).flatten()
      if query.size == 0 or not np.all(query == query[0]):
          raise ValueError(
              "missing query value or not all values are the same: value={}, "
              "metric_keys={}, StandardMetricInputs={}".format(
                  query, self._metric_keys, element
              )
          )
      return query[0]
  
imports: from typing import Dict, Iterable, List, Optional, Tuple, Union
  import apache_beam
  import numpy
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 2 for calling the _NDCGCombiner obj's underlying member method code with example usage: obj._query(element) and returns: query