class_docstr: Metric parser for model monitor model quality bianry/muliti-classification data
class_docstr_tok: ["Metric","parser","for","model","monitor","model","quality","bianry\/muliti-classification","data"]
docstr: Translate the confusion matrix to a metric entry.
  
  Args:
      metric_name (_type_): Metric name.
      raw_data (_type_): Raw metric data.
docstr_tok: ["Translate","the","confusion","matrix","to","a","metric","entry",".","Args",":","metric_name","(","_type_",")",":","Metric","name",".","raw_data","(","_type_",")",":","Raw","metric","data","."]
code: def _parse_confusion_matrix(self, metric_name, raw_data):
      """Translate the confusion matrix to a metric entry.
  
      Args:
          metric_name (_type_): Metric name.
          raw_data (_type_): Raw metric data.
      """
      metric_data = []
      if metric_name != "confusion_matrix":
          return metric_data
  
      rows = []
      x_axis_name = []
      for dim1_name, dim1 in raw_data.items():
          y_axis_name = []
          col = []
          for dim2_name, dim2 in dim1.items():
              col.append(dim2)
              y_axis_name.append(dim2_name)
          x_axis_name.append(dim1_name)
          rows.append(col)
      metric_data.extend(
          [
              {
                  "name": metric_name,
                  "type": "matrix",
                  "x_axis_name": x_axis_name,
                  "y_axis_name": y_axis_name,
                  "value": rows,
              }
          ]
      )
      return metric_data
  
imports: from __future__ import absolute_import
  from abc import ABC, abstractmethod
  from enum import Enum
  from collections import defaultdict
  from typing import Union, List
  from sagemaker.model_card.schema_constraints import PYTHON_TYPE_TO_METRIC_VALUE_TYPE, METRIC_VALUE_TYPE_MAP, MetricTypeEnum
label_desc: Use image node_id 3 for calling the ClassificationParser obj's underlying member method code with example usage: obj._parse_confusion_matrix(metric_name, raw_data) and returns: metric_data, metric_data