class_docstr: Computes NDCG (normalized discounted cumulative gain).
class_docstr_tok: ["Computes","NDCG","(","normalized","discounted","cumulative","gain",")","."]
code: def extract_output(
      self, accumulator: _NDCGAccumulator
  ) -> Dict[metric_types.MetricKey, float]:
      output = {}
      for i, key in enumerate(self._metric_keys):
          if accumulator.total_weighted_examples > 0:
              output[key] = (
                  accumulator.ndcg[i]
                  / accumulator.total_weighted_examples
              )
          else:
              output[key] = float("nan")
      return output
  
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 9 for calling the _NDCGCombiner obj's underlying member method code with example usage: obj.extract_output(accumulator) and returns: output