code: def get_liftcurve_df(pred_probas, y, pos_label=1, n_rows=100):
      """returns a pd.DataFrame that can be used to generate a lift curve plot.
  
      Args:
          pred_probas (np.ndarray): predicted probabilities of the positive class
          y (np.ndarray): the actual labels (y_true), encoded 0, 1 [, 2, 3, etc]
          pos_label (int): label of the positive class. Defaults to 1.
  
      Returns:
          pd.DataFrame with columns=['pred_proba', 'y', 'index', 'index_percentage',
                  'positives', 'precision', 'cumulative_percentage_pos',
                  'random_pos', 'random_precision', 'random_cumulative_percentage_pos']
      """
      lift_df = (
          pd.DataFrame(
              {"pred_proba": pred_probas, "y": y.astype("int32")}
          )
          .sort_values("pred_proba", ascending=False)
          .reset_index(drop=True)
      )
      lift_df["index"] = (lift_df.index + 1).astype("int32")
      lift_df["index_percentage"] = (
          100 * lift_df["index"] / len(lift_df)
      ).astype("float32")
      lift_df["positives"] = (
          (lift_df.y == pos_label).astype(int).cumsum()
      )
      lift_df["precision"] = (
          100 * (lift_df["positives"] / lift_df["index"])
      ).astype("float32")
      lift_df["cumulative_percentage_pos"] = (
          100
          * (
              lift_df["positives"]
              / (lift_df.y == pos_label).astype(int).sum()
          )
      ).astype("float32")
      lift_df["random_pos"] = (
          (lift_df.y == pos_label).astype(int).mean() * lift_df["index"]
      ).astype("float32")
      lift_df["random_precision"] = (
          100 * (lift_df["random_pos"] / lift_df["index"])
      ).astype("float32")
      lift_df["random_cumulative_percentage_pos"] = (
          100
          * (
              lift_df["random_pos"]
              / (lift_df.y == pos_label).astype(int).sum()
          )
      ).astype("float32")
      for y_label in range(y.nunique()):
          lift_df["precision_" + str(y_label)] = (
              100
              * (lift_df.y == y_label).astype(int).cumsum()
              / lift_df["index"]
          )
      if len(lift_df) > 100:
          lift_df = lift_df.iloc[
              np.linspace(
                  0, len(lift_df), num=n_rows, dtype=int, endpoint=False
              )
          ]
      return lift_df
  
imports: from functools import partial
  import re
  from collections import Counter
  from typing import List, Union
  import warnings
  import numpy
  import pandas
  from pandas.api.types import is_numeric_dtype, is_categorical_dtype
  from dtreeviz.trees import ShadowDecTree
  from sklearn.metrics import make_scorer
  from sklearn.base import clone
  from sklearn.pipeline import Pipeline
  from sklearn.model_selection import KFold, StratifiedKFold
  from joblib import Parallel, delayed
label_desc: Use image node_id 23 for calling a global function with example usage: get_liftcurve_df(pred_probas, y, pos_label, n_rows) and returns: lift_df