class_docstr: Compare class.
  
  >>> cm1 = ConfusionMatrix(matrix={0:{0:2,1:50,2:6}, 1:{0:5,1:50,2:3}, 2:{0:1,1:7,2:50}})
  >>> cm2 = ConfusionMatrix(matrix={0:{0:50,1:2,2:6}, 1:{0:50,1:5,2:3}, 2:{0:1,1:55,2:2}})
  >>> cp = Compare({"cm1": cm1, "cm2": cm2})
  >>> print(cp)
  Best : cm1
  <BLANKLINE>
  Rank  Name   Class-Score       Overall-Score
  1     cm1    0.50278           0.58095
  2     cm2    0.33611           0.52857
  <BLANKLINE>
  >>> cp.best
  pycm.ConfusionMatrix(classes: [0, 1, 2])
  >>> cp.sorted
  ['cm1', 'cm2']
  >>> cp.best_name
  'cm1'
class_docstr_tok: ["Compare","class",".",">",">",">","cm1","=","ConfusionMatrix","(","matrix=","{","0",":","{","0:2,1:50,2:6","}",",","1",":","{","0:5,1:50,2:3","}",",","2",":","{","0:1,1:7,2:50","}","}",")",">",">",">","cm2","=","ConfusionMatrix","(","matrix=","{","0",":","{","0:50,1:2,2:6","}",",","1",":","{","0:50,1:5,2:3","}",",","2",":","{","0:1,1:55,2:2","}","}",")",">",">",">","cp","=","Compare","(","{","``","cm1","''",":","cm1",",","``","cm2","''",":","cm2","}",")",">",">",">","print","(","cp",")","Best",":","cm1","<","BLANKLINE",">","Rank","Name","Class-Score","Overall-Score","1","cm1","0.50278","0.58095","2","cm2","0.33611","0.52857","<","BLANKLINE",">",">",">",">","cp.best","pycm.ConfusionMatrix","(","classes",":","[","0",",","1",",","2","]",")",">",">",">","cp.sorted","[","'cm1","'",",","'cm2","'","]",">",">",">","cp.best_name","'cm1","'"]
docstr: Init method.
  
  :param cm_dict: dictionary of confusion matrices
  :type cm_dict: dict
  :param by_class: compare by class flag
  :type by_class: bool
  :param class_weight: class weights
  :type class_weight: dict
  :param class_benchmark_weight: class benchmark weights
  :type class_benchmark_weight: dict
  :param overall_benchmark_weight: overall benchmark weights
  :type overall_benchmark_weight: dict
  :param digit: scale (number of fraction digits)(default value: 5)
  :type digit: int
docstr_tok: ["Init","method",".",":","param","cm_dict",":","dictionary","of","confusion","matrices",":","type","cm_dict",":","dict",":","param","by_class",":","compare","by","class","flag",":","type","by_class",":","bool",":","param","class_weight",":","class","weights",":","type","class_weight",":","dict",":","param","class_benchmark_weight",":","class","benchmark","weights",":","type","class_benchmark_weight",":","dict",":","param","overall_benchmark_weight",":","overall","benchmark","weights",":","type","overall_benchmark_weight",":","dict",":","param","digit",":","scale","(","number","of","fraction","digits",")","(","default","value",":","5",")",":","type","digit",":","int"]
code: def __init__(
      self,
      cm_dict,
      by_class=False,
      class_weight=None,
      class_benchmark_weight=None,
      overall_benchmark_weight=None,
      digit=5,
  ):
      """
      Init method.
  
      :param cm_dict: dictionary of confusion matrices
      :type cm_dict: dict
      :param by_class: compare by class flag
      :type by_class: bool
      :param class_weight: class weights
      :type class_weight: dict
      :param class_benchmark_weight: class benchmark weights
      :type class_benchmark_weight: dict
      :param overall_benchmark_weight: overall benchmark weights
      :type overall_benchmark_weight: dict
      :param digit: scale (number of fraction digits)(default value: 5)
      :type digit: int
      """
      self.scores = None
      self.sorted = None
      self.classes = None
      __compare_assign_handler__(
          self,
          cm_dict,
          class_weight,
          class_benchmark_weight,
          overall_benchmark_weight,
          digit,
      )
      __compare_class_handler__(self, cm_dict)
      __compare_overall_handler__(self, cm_dict)
      __compare_rounder__(self, cm_dict)
      scores_list = list(self.scores.values())
      (max_overall_name, max_class_name) = __compare_sort_handler__(
          self
      )
      if scores_list.count(self.scores[max_class_name]) == 1:
          if by_class:
              self.best = cm_dict[max_class_name]
              self.best_name = max_class_name
          else:
              if max_overall_name == max_class_name:
                  self.best = cm_dict[max_class_name]
                  self.best_name = max_overall_name
              else:
                  warn(COMPARE_RESULT_WARNING, RuntimeWarning)
      else:
          warn(COMPARE_RESULT_WARNING, RuntimeWarning)
  
imports: from __future__ import division
  from .pycm_error import pycmCompareError
  from .pycm_output import *
  from .pycm_util import *
  from .pycm_param import *
  from .pycm_obj import ConfusionMatrix
  import os
  import numpy
  from warnings import warn
label_desc: Use image node_id 1 to create a new Compare object  with example: obj = Compare(cm_dict, by_class, class_weight, class_benchmark_weight, overall_benchmark_weight, digit)