code: def confusion_matrix_plot(
      y_test,
      pred,
      scaled=True,
      label_x_neg="PREDICTED NEGATIVE",
      label_x_pos="PREDICTED POSITIVE",
      label_y_neg="ACTUAL NEGATIVE",
      label_y_pos="ACTUAL POSITIVE",
  ):
      """
      Plots a confusion matrix for a binary classifier with the expected and
      predicted values provided.
  
      :Example:
  
      xai.confusion_matrix_plot(
          actual_labels,
          predicted_labels,
          scaled=True)
  
      :param y_test: Array containing binary "actual" labels for data
      :type y_test: Union[np.array, list]
      :param pred: Array containing binary "predictedd" labels for data
      :type pred: Union[np.array, list]
      :param scaled: [Default: True] Whether the values are scaled to 0-1 or
      displayed as total number of instances
      :type scaled: bool
      :param label_x_neg: [Default: "PREDICTED NEGATIVE"] Plot label for
      the predicted negative values
      :type label_x_neg: str
      :param label_x_pos: [Default: "PREDICTED POSITIVE"] Plot label for
      the predicted positive values
      :type label_x_pos: str
      :param label_y_neg: [Default: "ACTUAL NEGATIVE"] Plot label for
      the actual negative values
      :type label_y_neg: str
      :param label_y_pos: [Default: "ACTUAL POSITIVE"] Plot label for
      the actual positive values
      :type label_y_pos: str
      :returns: Null
      :rtype: None
      """
  
      confusion = confusion_matrix(y_test, pred)
      columns = [label_y_neg, label_y_pos]
      index = [label_x_neg, label_x_pos]
  
      if scaled:
          confusion_scaled = (
              confusion.astype("float")
              / confusion.sum(axis=1)[:, np.newaxis]
          )
          confusion = pd.DataFrame(
              confusion_scaled, index=index, columns=columns
          )
      else:
          confusion = pd.DataFrame(
              confusion, index=index, columns=columns
          )
  
      cmap = plt.get_cmap("Blues")
      plt.figure()
      plt.imshow(confusion, interpolation="nearest", cmap=cmap)
      plt.title("Confusion matrix")
      plt.colorbar()
  
      plt.xticks(np.arange(2), columns, rotation=45)
      plt.yticks(np.arange(2), index, rotation=45)
  
      threshold = 0.5 if scaled else confusion.max().max() / 2
      for i, j in itertools.product(
          range(confusion.shape[0]), range(confusion.shape[1])
      ):
          txt = "{:,}".format(confusion.iloc[i, j])
          if scaled:
              txt = "{:0.4f}".format(confusion.iloc[i, j])
          plt.text(
              j,
              i,
              txt,
              horizontalalignment="center",
              color=(
                  "white"
                  if confusion.iloc[i, j] > threshold
                  else "black"
              ),
          )
  
      plt.tight_layout()
      plt.show()
  
imports: import pandas
  import matplotlib.pyplot
  import numpy
  from scipy.stats import spearmanr
  from scipy.cluster import hierarchy
  from typing import List, Any, Union, Tuple, Optional, Dict
  import random, math
  from sklearn.metrics import roc_curve, precision_recall_curve, roc_auc_score, confusion_matrix
  import itertools
  import logging
label_desc: Use image node_id 9 for calling a global function with example usage: confusion_matrix_plot(y_test, pred, scaled, label_x_neg, label_x_pos, label_y_neg, label_y_pos) without return types