code: def confusion_matrix(
      y_true,
      y_pred,
      target_names=None,
      normalize=False,
      cmap=None,
      ax=None,
  ):
      """
      Plot confusion matrix.
  
      Parameters
      ----------
      y_true : array-like, shape = [n_samples]
          Correct target values (ground truth).
      y_pred : array-like, shape = [n_samples]
          Target predicted classes (estimator predictions).
      target_names : list
          List containing the names of the target classes. List must be in order
          e.g. ``['Label for class 0', 'Label for class 1']``. If ``None``,
          generic labels will be generated e.g. ``['Class 0', 'Class 1']``
      ax: matplotlib Axes
          Axes object to draw the plot onto, otherwise uses current Axes
      normalize : bool
          Normalize the confusion matrix
      cmap : matplotlib Colormap
          If ``None`` uses a modified version of matplotlib's OrRd colormap.
  
  
      Returns
      -------
      ax: matplotlib Axes
          Axes containing the plot
  
      Examples
      --------
      .. plot:: ../examples/confusion_matrix.py
  
      """
      return ConfusionMatrix.from_raw_data(
          y_true=y_true,
          y_pred=y_pred,
          target_names=target_names,
          normalize=normalize,
          cmap=cmap,
      ).ax_
  
imports: import json
  from pathlib import Path
  import numpy
  import matplotlib.pyplot
  from sklearn.metrics import confusion_matrix
  from sklearn_evaluation import __version__
  from ..telemetry import SKLearnEvaluationLogger
  from ..plot.matplotlib import bar
  from ..metrics import precision_at
  from ..None import compute
  from ..util import is_column_vector, is_row_vector, default_heatmap
  from sklearn_evaluation.plot.plot import AbstractPlot, AbstractComposedPlot
  from ..plot import _matrix
  from ploomber_core.exceptions import modify_exceptions
label_desc: Use image node_id 2 for calling a global function with example usage: confusion_matrix(y_true, y_pred, target_names, normalize, cmap, ax) and returns: ConfusionMatrix