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: Init method.
  
  :param actual_vector: actual vector
  :type actual_vector: python list or numpy array of any stringable objects
  :param predict_vector: vector of predictions
  :type predict_vector: python list or numpy array of any stringable objects
  :param matrix: the confusion matrix
  :type matrix: dict, list or numpy array
  :param digit: scale (number of fraction digits)(default value: 5)
  :type digit: int
  :param threshold: activation threshold function
  :type threshold: FunctionType (function or lambda)
  :param file: saved confusion matrix file object
  :type file: (io.IOBase & file)
  :param sample_weight: sample weights list
  :type sample_weight: list
  :param transpose: transpose flag
  :type transpose: bool
  :param classes: ordered labels of classes
  :type classes: list
  :param is_imbalanced: imbalance dataset flag
  :type is_imbalanced: bool
  :param metrics_off: metrics off flag
  :type metrics_off: bool
code: def __init__(
      self,
      actual_vector=None,
      predict_vector=None,
      matrix=None,
      digit=5,
      threshold=None,
      file=None,
      sample_weight=None,
      transpose=False,
      classes=None,
      is_imbalanced=None,
      metrics_off=False,
  ):
      """
      Init method.
  
      :param actual_vector: actual vector
      :type actual_vector: python list or numpy array of any stringable objects
      :param predict_vector: vector of predictions
      :type predict_vector: python list or numpy array of any stringable objects
      :param matrix: the confusion matrix
      :type matrix: dict, list or numpy array
      :param digit: scale (number of fraction digits)(default value: 5)
      :type digit: int
      :param threshold: activation threshold function
      :type threshold: FunctionType (function or lambda)
      :param file: saved confusion matrix file object
      :type file: (io.IOBase & file)
      :param sample_weight: sample weights list
      :type sample_weight: list
      :param transpose: transpose flag
      :type transpose: bool
      :param classes: ordered labels of classes
      :type classes: list
      :param is_imbalanced: imbalance dataset flag
      :type is_imbalanced: bool
      :param metrics_off: metrics off flag
      :type metrics_off: bool
      """
      self.actual_vector = actual_vector
      self.predict_vector = predict_vector
      self.metrics_off = metrics_off
      self.prob_vector = None
      self.digit = digit
      self.weights = None
      self.classes = None
      self.imbalance = None
      if isinstance(transpose, bool):
          self.transpose = transpose
      else:
          self.transpose = False
      if isfile(file):
          matrix_param = __obj_file_handler__(self, file)
      elif isinstance(matrix, dict):
          matrix_param = __obj_matrix_handler__(
              matrix, classes, self.transpose
          )
      elif isinstance(matrix, (list, numpy.ndarray)):
          matrix_param = __obj_array_handler__(
              matrix, classes, self.transpose
          )
      else:
          matrix_param = __obj_vector_handler__(
              self,
              actual_vector,
              predict_vector,
              threshold,
              sample_weight,
              classes,
          )
      __obj_assign_handler__(self, matrix_param)
      if not metrics_off:
          __class_stat_init__(self)
          __overall_stat_init__(self)
          __imbalancement_handler__(self, is_imbalanced)
      self.binary = binary_check(self.classes)
      self.recommended_list = statistic_recommend(
          self.classes, self.imbalance
      )
      self.sparse_matrix = None
      self.sparse_normalized_matrix = None
      self.positions = None
      self.label_map = {x: x for x in self.classes}
  
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 1 to create a new ConfusionMatrix object  with example: obj = ConfusionMatrix(actual_vector, predict_vector, matrix, digit, threshold, file, sample_weight, transpose, classes, is_imbalanced, metrics_off)