Guest User

Untitled

a guest
Aug 21st, 2019
239
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2. from sklearn.metrics import roc_curve
  3.  
  4. def compute_inverse_eer(y_true, scores):
  5.  
  6. fpr, tpr, thresholds = roc_curve(y_true, scores, pos_label=1)
  7. fnr = 1 - tpr
  8. try:
  9. eer = fpr[np.nanargmin(np.absolute((fnr - fpr)))]
  10. except ValueError:
  11. eer = 0.0 # TODO: fix this
  12. return 1 - eer
RAW Paste Data