title: Equal Error Rate in Python
body: <p>Could anybody tell me how could I compute Equal Error Rate(EER) from ROC Curve in python? In scikit-learn there is method to compute roc curve and auc but could not find the method to compute EER.</p>
  
  <pre><code>from sklearn.metrics import roc_curve, auc
  </code></pre>
  
  <p>ANSRWER:</p>
  
  <p>I think I implemented myself.</p>
  
  <p>The idea of ROC EER is the intersection point between a stright line joining
  (1,0) and (0,1) and the roc Curve. It is a only point where it intersects. For a straight line with a=1 and b=1, the equation would be <code> x+y =1 (x/a +y/b =1.0) </code>. So the intersection point would be the values of true positive rate (tpr) and false positive rate (fpr) which statisfies the following equation:</p>
  
  <pre><code>    x + y - 1.0 = 0.0
  </code></pre>
  
  <p>Thus implemented the method as:</p>
  
  <pre><code> def compute_roc_EER(fpr, tpr):
      roc_EER = []
      cords = zip(fpr, tpr)
      for item in cords:
          item_fpr, item_tpr = item
          if item_tpr + item_fpr == 1.0:
              roc_EER.append((item_fpr, item_tpr))
  assert(len(roc_EER) == 1.0)
  return np.array(roc_EER)
  </code></pre>
  
  <p>So here one value is error rate and another value is accuracy. </p>
  
  <p>May be somebody could help me to verify.</p>