code: def det_curve(y_true, scores, distances=False):
      
  
      if distances:
          scores = -scores
  
      # compute false positive and false negative rates
      # (a.k.a. false alarm and false rejection rates)
      fpr, tpr, thresholds = sklearn.metrics.roc_curve(
          y_true, scores, pos_label=True)
      fnr = 1 - tpr
      if distances:
          thresholds = -thresholds
  
      # estimate equal error rate
      eer_index = np.where(fpr > fnr)[0][0]
      eer = .25 * (fpr[eer_index-1] + fpr[eer_index] +
                   fnr[eer_index-1] + fnr[eer_index])
  
      return fpr, fnr, thresholds, eer
docs: DET curve
  
      Parameters
      ----------
      y_true : (n_samples, ) array-like
          Boolean reference.
      scores : (n_samples, ) array-like
          Predicted score.
      distances : boolean, optional
          When True, indicate that `scores` are actually `distances`
  
      Returns
      -------
      fpr : numpy array
          False alarm rate
      fnr : numpy array
          False rejection rate
      thresholds : numpy array
          Corresponding thresholds
      eer : float
          Equal error rate