code: def confusion_matrix(
      y_true=None,
      y_pred=None,
      labels=None,
      true_labels=None,
      pred_labels=None,
      normalize=False,
  ):
      """Compute the confusion matrix to evaluate the performance of a classification.
  
      Called by plot_confusion_matrix to visualize roc curves. Please use the function
      plot_confusion_matrix() if you wish to visualize your confusion matrix.
      """
      cm = metrics.confusion_matrix(y_true, y_pred)
  
      if labels is None:
          classes = unique_labels(y_true, y_pred)
      else:
          classes = np.asarray(labels)
  
      if normalize:
          cm = cm.astype("float") / cm.sum(axis=1)[:, np.newaxis]
          cm = np.around(cm, decimals=2)
          cm[np.isnan(cm)] = 0.0
  
      if true_labels is None:
          true_classes = classes
      else:
          validate_labels(classes, true_labels, "true_labels")
  
          true_label_indexes = np.in1d(classes, true_labels)
  
          true_classes = classes[true_label_indexes]
          cm = cm[true_label_indexes]
  
      if pred_labels is None:
          pred_classes = classes
      else:
          validate_labels(classes, pred_labels, "pred_labels")
  
          pred_label_indexes = np.in1d(classes, pred_labels)
  
          pred_classes = classes[pred_label_indexes]
          cm = cm[:, pred_label_indexes]
  
      table = make_table(cm, pred_classes, true_classes, labels)
      chart = wandb.visualize("wandb/confusion_matrix/v1", table)
  
      return chart
  
file_path: wandb/wandb/sklearn/calculate/confusion_matrix.py
imports: import itertools
  from warnings import simplefilter
  import numpy
  from sklearn import metrics
  from sklearn.utils.multiclass import unique_labels
  import wandb
  from wandb.sklearn import utils
label_desc: Use image node_id 2 for calling a global function with example usage: confusion_matrix(y_true, y_pred, labels, true_labels, pred_labels, normalize) and returns: chart