code: def bedroc_score(
      y_true: np.ndarray, y_pred: np.ndarray, alpha: float = 20.0
  ):
      """Compute BEDROC metric.
  
      BEDROC metric implemented according to Truchon and Bayley that modifies
      the ROC score by allowing for a factor of early recognition.
      Please confirm details from [1]_.
  
      Parameters
      ----------
      y_true: np.ndarray
          Binary class labels. 1 for positive class, 0 otherwise
      y_pred: np.ndarray
          Predicted labels
      alpha: float, default 20.0
          Early recognition parameter
  
      Returns
      -------
      float
          Value in [0, 1] that indicates the degree of early recognition
  
      Notes
      -----
      This function requires RDKit to be installed.
  
      References
      ----------
      .. [1] Truchon et al. "Evaluating virtual screening methods: good and bad metrics
        for the “early recognition” problem." Journal of chemical information and modeling
        47.2 (2007): 488-508.
      """
      try:
          from rdkit.ML.Scoring.Scoring import CalcBEDROC
      except ModuleNotFoundError:
          raise ImportError(
              "This function requires RDKit to be installed."
          )
  
      # validation
      assert len(y_true) == len(
          y_pred
      ), "Number of examples do not match"
      assert np.array_equal(
          np.unique(y_true).astype(int), [0, 1]
      ), "Class labels must be binary: %s" % np.unique(y_true)
  
      yt = np.asarray(y_true)
      yp = np.asarray(y_pred)
  
      yt = yt.flatten()
      yp = yp[:, 1].flatten()  # Index 1 because one_hot predictions
  
      scores = list(zip(yt, yp))
      scores = sorted(scores, key=lambda pair: pair[1], reverse=True)
  
      return CalcBEDROC(scores, 0, alpha)
  
imports: import numpy
  import scipy.stats
  from sklearn.metrics import matthews_corrcoef
  from sklearn.metrics import recall_score
  from sklearn.metrics import cohen_kappa_score
  from sklearn.metrics import r2_score
  from sklearn.metrics import mean_squared_error
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import precision_score
  from sklearn.metrics import precision_recall_curve
  from sklearn.metrics import auc
  from sklearn.metrics import jaccard_score
  from sklearn.metrics import f1_score
  from sklearn.metrics import roc_auc_score
  from sklearn.metrics import accuracy_score
  from sklearn.metrics import balanced_accuracy_score
  from sklearn.metrics import top_k_accuracy_score
label_desc: Use image node_id 8 for calling a global function with example usage: bedroc_score(y_true, y_pred, alpha) and returns: CalcBEDROC