class_docstr: Confusion matrix class.
  
  >>> y_actu = [2, 0, 2, 2, 0, 1, 1, 2, 2, 0, 1, 2]
  >>> y_pred = [0, 0, 2, 1, 0, 2, 1, 0, 2, 0, 2, 2]
  >>> cm = ConfusionMatrix(y_actu, y_pred)
  >>> cm.classes
  [0, 1, 2]
  >>> cm.table
  {0: {0: 3, 1: 0, 2: 0}, 1: {0: 0, 1: 1, 2: 2}, 2: {0: 2, 1: 1, 2: 3}}
  >>> cm2 = ConfusionMatrix(matrix={"Class1": {"Class1": 1, "Class2": 2}, "Class2": {"Class1": 0, "Class2": 5}})
  >>> cm2
  pycm.ConfusionMatrix(classes: ['Class1', 'Class2'])
class_docstr_tok: ["Confusion","matrix","class",".",">",">",">","y_actu","=","[","2",",","0",",","2",",","2",",","0",",","1",",","1",",","2",",","2",",","0",",","1",",","2","]",">",">",">","y_pred","=","[","0",",","0",",","2",",","1",",","0",",","2",",","1",",","0",",","2",",","0",",","2",",","2","]",">",">",">","cm","=","ConfusionMatrix","(","y_actu",",","y_pred",")",">",">",">","cm.classes","[","0",",","1",",","2","]",">",">",">","cm.table","{","0",":","{","0",":","3",",","1",":","0",",","2",":","0","}",",","1",":","{","0",":","0",",","1",":","1",",","2",":","2","}",",","2",":","{","0",":","2",",","1",":","1",",","2",":","3","}","}",">",">",">","cm2","=","ConfusionMatrix","(","matrix=","{","``","Class1","''",":","{","``","Class1","''",":","1",",","``","Class2","''",":","2","}",",","``","Class2","''",":","{","``","Class1","''",":","0",",","``","Class2","''",":","5","}","}",")",">",">",">","cm2","pycm.ConfusionMatrix","(","classes",":","[","'Class1","'",",","'Class2","'","]",")"]
docstr: Save the ConfusionMatrix object in .pycm (flat file format).
  
  :param name: filename
  :type name: str
  :param address: flag for address return
  :type address: bool
  :param overall_param: overall parameters list for save, Example: ["Kappa", "Scott PI"]
  :type overall_param: list
  :param class_param: class parameters list for save, Example: ["TPR", "TNR", "AUC"]
  :type class_param: list
  :param class_name: class name (subset of classes names), Example: [1, 2, 3]
  :type class_name: list
  :param summary: summary mode flag
  :type summary: bool
  :param sparse: sparse mode printing flag
  :type sparse: bool
  :return: saving address as dict {"Status":bool, "Message":str}
code: def save_stat(
      self,
      name,
      address=True,
      overall_param=None,
      class_param=None,
      class_name=None,
      summary=False,
      sparse=False,
  ):
      """
      Save the ConfusionMatrix object in .pycm (flat file format).
  
      :param name: filename
      :type name: str
      :param address: flag for address return
      :type address: bool
      :param overall_param: overall parameters list for save, Example: ["Kappa", "Scott PI"]
      :type overall_param: list
      :param class_param: class parameters list for save, Example: ["TPR", "TNR", "AUC"]
      :type class_param: list
      :param class_name: class name (subset of classes names), Example: [1, 2, 3]
      :type class_name: list
      :param summary: summary mode flag
      :type summary: bool
      :param sparse: sparse mode printing flag
      :type sparse: bool
      :return: saving address as dict {"Status":bool, "Message":str}
      """
      try:
          message = None
          class_list = class_param
          overall_list = overall_param
          warning_message = ""
          if summary:
              class_list = SUMMARY_CLASS
              overall_list = SUMMARY_OVERALL
          classes = self.classes
          table = self.table
          file = open(name + ".pycm", "w", encoding="utf-8")
          if sparse is True:
              if self.sparse_matrix is None:
                  self.sparse_matrix = sparse_matrix_calc(
                      classes, table
                  )
              matrix = (
                  "Matrix : \n\n"
                  + sparse_table_print(self.sparse_matrix)
                  + "\n\n"
              )
              if self.sparse_normalized_matrix is None:
                  self.sparse_normalized_matrix = sparse_matrix_calc(
                      classes, self.normalized_table
                  )
              normalized_matrix = (
                  "Normalized Matrix : \n\n"
                  + sparse_table_print(self.sparse_normalized_matrix)
                  + "\n\n"
              )
          else:
              matrix = (
                  "Matrix : \n\n"
                  + table_print(self.classes, self.table)
                  + "\n\n"
              )
              normalized_matrix = (
                  "Normalized Matrix : \n\n"
                  + table_print(self.classes, self.normalized_table)
                  + "\n\n"
              )
          one_vs_all = "\nOne-Vs-All : \n\n"
          for c in self.classes:
              one_vs_all += str(c) + "-Vs-All : \n\n"
              [classes, table] = one_vs_all_func(
                  self.classes,
                  self.table,
                  self.TP,
                  self.TN,
                  self.FP,
                  self.FN,
                  c,
              )
              one_vs_all += table_print(classes, table) + "\n\n"
          classes = class_filter(self.classes, class_name)
          stat = stat_print(
              classes,
              self.class_stat,
              self.overall_stat,
              self.digit,
              overall_list,
              class_list,
          )
          if len(self.classes) >= CLASS_NUMBER_THRESHOLD:
              warning_message = (
                  "\n" + "Warning : " + CLASS_NUMBER_WARNING + "\n"
              )
          file.write(
              matrix
              + normalized_matrix
              + stat
              + one_vs_all
              + warning_message
          )
          file.close()
          if address:
              message = os.path.join(
                  os.getcwd(), name + ".pycm"
              )  # pragma: no cover
          return {"Status": True, "Message": message}
      except Exception as e:
          return {"Status": False, "Message": str(e)}
  
imports: from __future__ import division
  from .pycm_error import pycmVectorError, pycmMatrixError, pycmCIError, pycmAverageError, pycmPlotError
  from .pycm_handler import __class_stat_init__, __overall_stat_init__
  from .pycm_handler import __obj_assign_handler__, __obj_file_handler__, __obj_matrix_handler__, __obj_vector_handler__, __obj_array_handler__
  from .pycm_handler import __imbalancement_handler__
  from .pycm_class_func import F_calc, IBA_calc, TI_calc, NB_calc, sensitivity_index_calc
  from .pycm_overall_func import weighted_kappa_calc, weighted_alpha_calc, alpha2_calc, brier_score_calc, log_loss_calc
  from .pycm_distance import DistanceType, DISTANCE_MAPPER
  from .pycm_output import *
  from .pycm_util import *
  from .pycm_param import *
  from .pycm_ci import __CI_overall_handler__, __CI_class_handler__
  import os
  import json
  import numpy
  from warnings import warn
label_desc: Use image node_id 9 for calling the ConfusionMatrix obj's underlying member method code with example usage: obj.save_stat(name, address, overall_param, class_param, class_name, summary, sparse) and returns: dict, dict