class_docstr: Abstract class for confusion matrix
  
  You shouldn't instantiate this class.
  You might instantiate ConfusionMatrix or BinaryConfusionMatrix classes
class_docstr_tok: ["Abstract","class","for","confusion","matrix","You","should","n't","instantiate","this","class",".","You","might","instantiate","ConfusionMatrix","or","BinaryConfusionMatrix","classes"]
code: def __init__(
      self,
      y_true,
      y_pred,
      labels=None,
      display_sum=True,
      backend="matplotlib",
      true_name="Actual",
      pred_name="Predicted",
  ):
      self.true_name = true_name
      self.pred_name = pred_name
  
      if isinstance(y_true, pd.Series):
          self._y_true = y_true
          self._y_true.name = self.true_name
      else:
          self._y_true = pd.Series(y_true, name=self.true_name)
  
      if isinstance(y_pred, pd.Series):
          self._y_pred = y_pred
          self._y_pred.name = self.pred_name
      else:
          self._y_pred = pd.Series(y_pred, name=self.pred_name)
  
      if labels is not None:
          if not self.is_binary:
              self._y_true = self._y_true.map(
                  lambda i: self._label(i, labels)
              )
              self._y_pred = self._y_pred.map(
                  lambda i: self._label(i, labels)
              )
          else:
              N = len(labels)
              assert len(labels) == 2, (
                  "labels be a list with length=2 - length=%d" % N
              )
              d = {labels[0]: False, labels[1]: True}
              self._y_true = self._y_true.map(d)
              self._y_pred = self._y_pred.map(d)
              raise (
                  NotImplementedError
              )  # ToDo: see self.classes and BinaryConfusionMatrix.__class ...
  
      N_true = len(y_true)
      N_pred = len(y_pred)
      assert (
          N_true == N_pred
      ), "y_true must have same size - %d != %d" % (N_true, N_pred)
  
      df = pd.crosstab(self._y_true, self._y_pred)
      idx = self._classes(df)
  
      if self.is_binary and pdml.compat._PANDAS_ge_021:
          df = df.reindex([False, True])
          df = df.reindex([False, True], axis=1)
          df = df.fillna(0)
      else:
          df = df.loc[idx, idx.copy()].fillna(
              0
          )  # if some columns or rows are missing
  
      self._df_confusion = df
      self._df_confusion.index.name = self.true_name
      self._df_confusion.columns.name = self.pred_name
      self._df_confusion = self._df_confusion.astype(np.int64)
  
      self._len = len(idx)
  
      self.backend = backend
      self.display_sum = display_sum
  
imports: import numpy
  import pandas
  import collections
  import pandas_ml
  from pandas_ml.confusion_matrix.stats import binom_interval, class_agreement, prop_test
label_desc: Use image node_id 1 to create a new ConfusionMatrixAbstract object from inherited base classes: object with example: obj = ConfusionMatrixAbstract(y_true, y_pred, labels, display_sum, backend, true_name, pred_name)