code: def _multi_class_confusion_matrix_plot(
      thresholds: Optional[List[float]] = None,
      num_thresholds: Optional[int] = None,
      name: str = MULTI_CLASS_CONFUSION_MATRIX_PLOT_NAME,
      eval_config: Optional[config_pb2.EvalConfig] = None,
      model_name: str = "",
      output_name: str = "",
      example_weighted: bool = False,
  ) -> metric_types.MetricComputations:
      """Returns computations for multi-class confusion matrix plot."""
      if num_thresholds is None and thresholds is None:
          thresholds = [0.0]
  
      key = metric_types.PlotKey(
          name=name,
          model_name=model_name,
          output_name=output_name,
          example_weighted=example_weighted,
      )
  
      # Make sure matrices are calculated.
      matrices_computations = multi_class_confusion_matrix_metrics.multi_class_confusion_matrices(
          thresholds=thresholds,
          num_thresholds=num_thresholds,
          eval_config=eval_config,
          model_name=model_name,
          output_name=output_name,
          example_weighted=example_weighted,
      )
      matrices_key = matrices_computations[-1].keys[-1]
  
      def result(
          metrics: Dict[
              metric_types.MetricKey,
              multi_class_confusion_matrix_metrics.Matrices,
          ]
      ) -> Dict[
          metric_types.PlotKey,
          metrics_for_slice_pb2.MultiClassConfusionMatrixAtThresholds,
      ]:
          return {
              key: metrics[matrices_key]
              .to_proto()
              .multi_class_confusion_matrix_at_thresholds
          }
  
      derived_computation = metric_types.DerivedMetricComputation(
          keys=[key], result=result
      )
      computations = matrices_computations
      computations.append(derived_computation)
      return computations
  
file_path: model-analysis/tensorflow_model_analysis/metrics/multi_class_confusion_matrix_plot.py
imports: from typing import Dict, List, Optional
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.metrics import metric_util
  from tensorflow_model_analysis.metrics import multi_class_confusion_matrix_metrics
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.proto import metrics_for_slice_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: _multi_class_confusion_matrix_plot(thresholds, num_thresholds, name, eval_config, model_name, output_name, example_weighted) and returns: computations, dict