class_docstr: Interpretation methods for classification models.
docstr: Plot the confusion matrix, with `title` and using `cmap`.
docstr_tok: ["Plot","the","confusion","matrix",",","with","`","title","`","and","using","`","cmap","`","."]
code: def plot_confusion_matrix(
      self,
      normalize: bool = False,  # Whether to normalize occurrences
      title: str = "Confusion matrix",  # Title of plot
      cmap: str = "Blues",  # Colormap from matplotlib
      norm_dec: int = 2,  # Decimal places for normalized occurrences
      plot_txt: bool = True,  # Display occurrence in matrix
      **kwargs,
  ):
      "Plot the confusion matrix, with `title` and using `cmap`."
      # This function is mainly copied from the sklearn docs
      cm = self.confusion_matrix()
      if normalize:
          cm = cm.astype("float") / cm.sum(axis=1)[:, np.newaxis]
      fig = plt.figure(**kwargs)
      plt.imshow(cm, interpolation="nearest", cmap=cmap)
      plt.title(title)
      tick_marks = np.arange(len(self.vocab))
      plt.xticks(tick_marks, self.vocab, rotation=90)
      plt.yticks(tick_marks, self.vocab, rotation=0)
  
      if plot_txt:
          thresh = cm.max() / 2.0
          for i, j in itertools.product(
              range(cm.shape[0]), range(cm.shape[1])
          ):
              coeff = (
                  f"{cm[i, j]:.{norm_dec}f}"
                  if normalize
                  else f"{cm[i, j]}"
              )
              plt.text(
                  j,
                  i,
                  coeff,
                  horizontalalignment="center",
                  verticalalignment="center",
                  color="white" if cm[i, j] > thresh else "black",
              )
  
      ax = fig.gca()
      ax.set_ylim(len(self.vocab) - 0.5, -0.5)
  
      plt.tight_layout()
      plt.ylabel("Actual")
      plt.xlabel("Predicted")
      plt.grid(False)
  
imports: from __future__ import annotations
  from .data.all import *
  from .optimizer import *
  from .learner import *
  from .tabular.core import *
  import sklearn.metrics
label_desc: Use image node_id 3 for calling the ClassificationInterpretation obj's underlying member method code with example usage: obj.plot_confusion_matrix(normalize, title, cmap, norm_dec, plot_txt) without return types