code: def default_multi_class_classification_specs(
      model_names: Optional[List[str]] = None,
      output_names: Optional[List[str]] = None,
      output_weights: Optional[Dict[str, float]] = None,
      binarize: Optional[config_pb2.BinarizationOptions] = None,
      aggregate: Optional[config_pb2.AggregationOptions] = None,
      sparse: bool = True,
  ) -> List[config_pb2.MetricsSpec]:
      """Returns default metric specs for multi-class classification problems.
  
      Args:
        model_names: Optional model names if multi-model evaluation.
        output_names: Optional list of output names (if multi-output model).
        output_weights: Optional output weights for creating overall metric
          aggregated across outputs (if multi-output model). If a weight is not
          provided for an output, it's weight defaults to 0.0 (i.e. output ignored).
        binarize: Optional settings for binarizing multi-class/multi-label metrics.
        aggregate: Optional settings for aggregating multi-class/multi-label
          metrics.
        sparse: True if the labels are sparse.
      """
  
      if sparse:
          metrics = [
              tf.keras.metrics.SparseCategoricalCrossentropy(
                  name="loss"
              ),
              tf.keras.metrics.SparseCategoricalAccuracy(
                  name="accuracy"
              ),
          ]
      else:
          metrics = [
              tf.keras.metrics.CategoricalCrossentropy(name="loss"),
              tf.keras.metrics.CategoricalAccuracy(name="accuracy"),
          ]
      metrics.append(
          multi_class_confusion_matrix_plot.MultiClassConfusionMatrixPlot()
      )
      if binarize is not None:
          for top_k in binarize.top_k_list.values:
              metrics.extend(
                  [
                      confusion_matrix_metrics.Precision(
                          name="precision", top_k=top_k
                      ),
                      confusion_matrix_metrics.Recall(
                          name="recall", top_k=top_k
                      ),
                  ]
              )
          binarize_without_top_k = config_pb2.BinarizationOptions()
          binarize_without_top_k.CopyFrom(binarize)
          binarize_without_top_k.ClearField("top_k_list")
          binarize = binarize_without_top_k
      multi_class_metrics = specs_from_metrics(
          metrics,
          model_names=model_names,
          output_names=output_names,
          output_weights=output_weights,
      )
      if aggregate is None:
          aggregate = config_pb2.AggregationOptions(micro_average=True)
      multi_class_metrics.extend(
          default_binary_classification_specs(
              model_names=model_names,
              output_names=output_names,
              output_weights=output_weights,
              binarize=binarize,
              aggregate=aggregate,
          )
      )
      return multi_class_metrics
  
imports: import collections
  import importlib
  import json
  import re
  from typing import Any, Dict, FrozenSet, Iterable, Iterator, List, NamedTuple, Optional, Tuple, Type, Union
  import tensorflow
  from tensorflow_model_analysis.metrics import aggregation
  from tensorflow_model_analysis.metrics import binary_confusion_matrices
  from tensorflow_model_analysis.metrics import calibration
  from tensorflow_model_analysis.metrics import calibration_plot
  from tensorflow_model_analysis.metrics import confusion_matrix_metrics
  from tensorflow_model_analysis.metrics import confusion_matrix_plot
  from tensorflow_model_analysis.metrics import example_count
  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_plot
  from tensorflow_model_analysis.metrics import tf_metric_wrapper
  from tensorflow_model_analysis.metrics import weighted_example_count
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.slicer import slicer_lib
  from tensorflow_model_analysis.utils import model_util
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 8 for calling a global function with example usage: default_multi_class_classification_specs(model_names, output_names, output_weights, binarize, aggregate, sparse) and returns: multi_class_metrics