class_docstr: The base metric for semantic segmentation confusion matrix based metrics.
  
  This is the base metric for other metrics such as true postive, true negative,
  false positvie and false negative.
class_docstr_tok: ["The","base","metric","for","semantic","segmentation","confusion","matrix","based","metrics",".","This","is","the","base","metric","for","other","metrics","such","as","true","postive",",","true","negative",",","false","positvie","and","false","negative","."]
code: def _metric_computations(
      self,
      class_ids: List[int],
      ground_truth_key: str,
      prediction_key: str,
      decode_ground_truth: bool = True,
      decode_prediction: bool = False,
      ignore_ground_truth_id: Optional[int] = None,
      name: Optional[str] = None,
      eval_config: Optional[config_pb2.EvalConfig] = None,
      model_name: str = "",
      output_name: str = "",
      example_weighted: bool = False,
      **kwargs,
  ) -> metric_types.MetricComputations:
      # generates private name to distinguish semantic segmentation confusion
      # matrix from different configs.
      semantic_segmentation_confusion_matrix_name = (
          metric_util.generate_private_name_from_arguments(
              class_ids=class_ids,
              ground_truth_key=ground_truth_key,
              prediction_key=prediction_key,
              decode_ground_truth=decode_ground_truth,
              decode_prediction=decode_prediction,
              ignore_ground_truth_id=ignore_ground_truth_id,
              name=name,
          )
      )
      maxtrix_computation = SemanticSegmentationConfusionMatrix(
          class_ids=class_ids,
          ground_truth_key=ground_truth_key,
          prediction_key=prediction_key,
          decode_ground_truth=decode_ground_truth,
          decode_prediction=decode_prediction,
          ignore_ground_truth_id=ignore_ground_truth_id,
          name=semantic_segmentation_confusion_matrix_name,
      )
      computations = maxtrix_computation.computations(
          model_names=[model_name],
          output_names=[output_name],
          example_weighted=example_weighted,
      )
      # This is the key to metric output for the entire matrix computation.
      # sub_key/class_id info is not encoded in the metric key yet.
      matrix_key = computations[-1].keys[-1]
  
      key = metric_types.MetricKey(
          name=name,
          model_name=model_name,
          output_name=output_name,
      )
  
      def result(
          metrics: Dict[metric_types.MetricKey, Any]
      ) -> Dict[metric_types.MetricKey, Union[float, np.ndarray]]:
          derived_output = {}
          for class_id in class_ids:
              class_matrix_key = matrix_key._replace(
                  sub_key=metric_types.SubKey(class_id=class_id)
              )
              class_output_key = key._replace(
                  sub_key=metric_types.SubKey(class_id=class_id)
              )
              derived_output[class_output_key] = self._metric_value(
                  metrics[class_matrix_key]
              )
          return derived_output
  
      derived_computation = metric_types.DerivedMetricComputation(
          keys=[key], result=result
      )
      computations.append(derived_computation)
  
      return computations
  
imports: import abc
  from typing import Any, Dict, Iterable, List, Optional, Union
  import apache_beam
  import numpy
  from tensorflow_model_analysis.contrib.aggregates import binary_confusion_matrices
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import preprocessors
  from tensorflow_model_analysis.proto import config_pb2
label_desc: Use image node_id 4 for calling the SemanticSegmentationConfusionMatrixMetricBase obj's underlying member method code with example usage: obj._metric_computations(class_ids, ground_truth_key, prediction_key, decode_ground_truth, decode_prediction, ignore_ground_truth_id, name, eval_config, model_name, output_name, example_weighted) and returns: computations, derived_output