code: def auc(y_pred, y_true):
      _df = pd.DataFrame({"y_pred": y_pred, "y_true": y_true})
      if _df.y_true.nunique() == 1:
          raise ValueError(
              "Only one class present in `y`. ROC AUC score is not defined in that case."
          )
      tpr_temp = (
          _df.groupby("y_pred")
          .sum()
          .reset_index()
          .sort_values("y_pred", ascending=False)
      )
      fpr_temp = (
          _df.assign(y_true=1 - _df.y_true)
          .groupby("y_pred")
          .sum()
          .reset_index()
          .sort_values("y_pred", ascending=False)
      )
  
      # assumes that y = 0/1 where 1 is the positive label
      tpr = (
          pd.concat([pd.Series([0]), tpr_temp.y_true.cumsum()])
          / _df.y_true.sum()
      )
      fpr = (
          pd.concat([pd.Series([0]), fpr_temp.y_true.cumsum()])
          / (1 - _df.y_true).sum()
      )
  
      _auc = (
          np.diff(fpr)
          * (tpr.iloc[1:].values + tpr.iloc[:-1].values)
          / 2
      ).sum()
  
      return _auc
  
file_path: DALEX/python/dalex/dalex/model_explanations/_model_performance/utils.py
imports: import numpy
  import pandas
label_desc: Use image node_id 6 for calling a global function with example usage: auc(y_pred, y_true) and returns: _auc