code: def cumulative_gain(
      y_true,
      y_score,
      figsize=None,
      title_fontsize="large",
      text_fontsize="medium",
      ax=None,
  ):
      """
      Generates the Cumulative Gains Plot from labels and scores/probabilities
      The cumulative gains chart is used to determine the effectiveness of a
      binary classifier. The implementation here works only for binary classification.
  
      Parameters
      ----------
      y_true : array-like, shape=[n_samples,]
          Ground truth (correct) target values.
          Refer: https://numpy.org/doc/stable/glossary.html#term-array-like
  
      y_score : array-like, shape=[n_samples, n_classes]
          Prediction probabilities for each class returned by a classifier.
          Refer: https://numpy.org/doc/stable/glossary.html#term-array-like
  
      figsize :2-tuple, optional
          Tuple denoting figure size of the plot e.g. (6, 6). Defaults to ``None``.
  
      title_fontsize : string or int, optional
          Matplotlib-style fontsizes. Use e.g. "small", "medium", "large" or
          integer-values. Defaults to "large".
  
      text_fontsize : string or int, optional
          Matplotlib-style fontsizes. Use e.g. "small", "medium",
          "large" or integer-values. Defaults to "medium".
  
      ax : matplotlib Axes, optional
          Axes object to draw the plot onto, otherwise uses current Axes
  
      Returns
      -------
      ax: matplotlib Axes
          Axes containing the plot
  
      Examples
      --------
      .. plot:: ../examples/cumulative_gain.py
  
      Notes
      -----
      .. versionadded:: 0.8.4
      """
      y_true = np.array(y_true)
      y_score = np.array(y_score)
  
      classes = np.unique(y_true)
      if len(classes) != 2:
          raise ValueError(
              "Cannot calculate Cumulative Gains for data with "
              "{} category/ies".format(len(classes))
          )
  
      # Compute Cumulative Gain Curves
      percentages, gains1 = _cumulative_gain_curve(
          y_true, y_score[:, 0], classes[0]
      )
      percentages, gains2 = _cumulative_gain_curve(
          y_true, y_score[:, 1], classes[1]
      )
  
      if ax is None:
          fig, ax = plt.subplots(1, 1, figsize=figsize)
  
      ax.set_title("Cumulative Gains Curve", fontsize=title_fontsize)
  
      ax.plot(
          percentages, gains1, lw=3, label="Class {}".format(classes[0])
      )
      ax.plot(
          percentages, gains2, lw=3, label="Class {}".format(classes[1])
      )
  
      ax.set_xlim([0.0, 1.0])
      ax.set_ylim([0.0, 1.0])
  
      ax.plot([0, 1], [0, 1], "k--", lw=2, label="Baseline")
  
      ax.set_xlabel("Percentage of sample", fontsize=text_fontsize)
      ax.set_ylabel("Gain", fontsize=text_fontsize)
      ax.tick_params(labelsize=text_fontsize)
      ax.grid("on")
      ax.legend(loc="lower right", fontsize=text_fontsize)
  
      return ax
  
imports: import numpy
  import matplotlib.pyplot
  from sklearn_evaluation.telemetry import SKLearnEvaluationLogger
  from ploomber_core.exceptions import modify_exceptions
label_desc: Use image node_id 2 for calling a global function with example usage: cumulative_gain(y_true, y_score, figsize, title_fontsize, text_fontsize, ax) and returns: ax