code: def create_confusion_matrix_figure(
      confusion_matrix_data: np.ndarray,
      classes_names: List[str],
      normalize_display: bool,
  ):
      """Create a confusion matrix figure.
  
      Parameters
      ----------
      confusion_matrix_data: np.ndarray
          2D array containing the confusion matrix.
      classes_names: List[str]
          the names of the classes to display as the axis.
      normalize_display: bool
          if True will also show normalized values by the true values.
  
      Returns
      -------
      plotly Figure object
          confusion matrix figure
  
      """
      confusion_matrix_norm = (
          confusion_matrix_data.astype("float")
          / (
              confusion_matrix_data.sum(axis=1)[:, np.newaxis]
              + np.finfo(float).eps
          )
          * 100
      )
      if normalize_display:
          z = np.vectorize(format_number_if_not_nan)(
              confusion_matrix_norm
          )
      else:
          z = confusion_matrix_data
  
      accuracy_array = np.diag(confusion_matrix_norm).round(decimals=2)
  
      display = []
      display_msg = f"The overall accuracy of your model is: {round(np.sum(accuracy_array)/len(accuracy_array), 2)}%."
  
      if min(accuracy_array) < 100:
          display_msg += (
              f"<br>Best accuracy achieved on samples with <b>{classes_names[np.argmax(accuracy_array)]}"
              f"</b> label ({np.max(accuracy_array)}%)."
          )
          display_msg += (
              f"<br>Worst accuracy achieved on samples with <b>{classes_names[np.argmin(accuracy_array)]}"
              f"</b> label ({np.min(accuracy_array)}%)."
          )
      display.append(display_msg)
  
      total_samples = np.nansum(confusion_matrix_data)
      percent_data_each_row = np.round(
          confusion_matrix_norm, decimals=2
      )
      percent_data_each_cell = np.round(
          np.divide(
              np.nan_to_num(confusion_matrix_data, nan=0.0),
              total_samples,
          )
          * 100,
          decimals=2,
      )
      percent_data_each_col = (
          confusion_matrix_data.astype("float")
          / (
              confusion_matrix_data.sum(axis=0)[:, np.newaxis]
              + np.finfo(float).eps
          )
          * 100
      ).round(decimals=2)
      custom_hoverdata = np.dstack(
          (
              percent_data_each_cell,
              percent_data_each_row,
              percent_data_each_col,
          )
      )
  
      fig = go.Figure(
          data=go.Heatmap(
              x=classes_names,
              y=classes_names,
              z=z,
              customdata=custom_hoverdata,
              xgap=1,
              ygap=1,
              text=confusion_matrix_data,
              texttemplate="%{text}",
              hovertemplate="% out of all data: <b>%{customdata[0]}%</b><br>% out "
              "of row: <b>%{customdata[1]}%</b><br>% out of column: "
              "<b>%{customdata[2]}%</b><extra></extra>",
              showscale=False,
          )
      )
      fig.update_layout(
          title="Confusion Matrix (# Samples)", title_x=0.5
      )
      fig.update_layout(height=600)
      fig.update_xaxes(
          title="Predicted Value",
          type="category",
          scaleanchor="y",
          constrain="domain",
      )
      fig.update_yaxes(
          title="True Value",
          type="category",
          constrain="domain",
          autorange="reversed",
      )
      display.append(fig)
      return display
  
file_path: deepchecks/deepchecks/utils/abstracts/confusion_matrix_abstract.py
imports: from typing import List
  import numpy
  import pandas
  import plotly.graph_objects
  from sklearn.metrics import confusion_matrix
  from deepchecks import ConditionCategory, ConditionResult
  from deepchecks.core import CheckResult
  from deepchecks.core.errors import DeepchecksValueError
  from deepchecks.utils.strings import format_number_if_not_nan, format_percent
label_desc: Use image node_id 2 for calling a global function with example usage: create_confusion_matrix_figure(confusion_matrix_data, classes_names, normalize_display) and returns: display