class_docstr: Base combiner for aggregating metrics for keras based models.
class_docstr_tok: ["Base","combiner","for","aggregating","metrics","for","keras","based","models","."]
code: def extract_output(
      self, accumulator: tf_metric_accumulators.TFMetricsAccumulator
  ) -> Dict[metric_types.MetricKey, np.ndarray]:
      # Finish processing last batch
      self._process_batch(accumulator)
      result = {}
      for metric_index, metric in enumerate(self._metrics()):
          key = self._keys[metric_index]
          weights = accumulator.get_weights(0, metric_index)
          if weights is not None:
              metric.set_weights(weights)
          else:
              metric.reset_states()
          result[key] = metric.result().numpy()
      return result
  
imports: import collections
  from itertools import chain
  from typing import Dict, Iterable, List, Optional
  import apache_beam
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import tf_metric_accumulators
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import model_util
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 12 for calling the _KerasCombiner obj's underlying member method code with example usage: obj.extract_output(accumulator) and returns: result