class_docstr: Computes class weights from labels.
class_docstr_tok: ["Computes","class","weights","from","labels","."]
code: def extract_output(
      self, accumulator: Dict[int, float]
  ) -> Dict[metric_types.MetricKey, Dict[int, float]]:
      total = sum(v for v in accumulator.values())
      class_weights = {
          k: (v / total) if total else 0.0
          for k, v in accumulator.items()
      }
      return {self._key: class_weights}
  
file_path: model-analysis/tensorflow_model_analysis/metrics/aggregation.py
imports: from typing import Any, Dict, Iterable, List, Optional
  import apache_beam
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 5 for calling the _ClassWeightsFromLabelsCombiner obj's underlying member method code with example usage: obj.extract_output(accumulator) and returns: dict