title: How to calculate a partial Area Under the Curve (AUC)
body: <p>In scikit learn you can compute the area under the curve for a binary classifier with</p>
  
  <pre><code>roc_auc_score( Y, clf.predict_proba(X)[:,1] )
  </code></pre>
  
  <p>I am only interested in the part of the curve where the false positive rate is less than 0.1.</p>
  
  <blockquote>
    <p>Given such a threshold false positive rate, how can I compute the AUC
    only for the part of the curve up the threshold?</p>
  </blockquote>
  
  <p>Here is an example with several ROC-curves, for illustration:</p>
  
  <p><a href="https://i.stack.imgur.com/Xg4uc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Xg4uc.png" alt="Illustration of ROC-curves plot for several types of a classifier."></a></p>
  
  <p>The scikit learn docs show how to use roc_curve</p>
  
  <pre><code>&gt;&gt;&gt; import numpy as np
  &gt;&gt;&gt; from sklearn import metrics
  &gt;&gt;&gt; y = np.array([1, 1, 2, 2])
  &gt;&gt;&gt; scores = np.array([0.1, 0.4, 0.35, 0.8])
  &gt;&gt;&gt; fpr, tpr, thresholds = metrics.roc_curve(y, scores, pos_label=2)
  &gt;&gt;&gt; fpr
  array([ 0. ,  0.5,  0.5,  1. ])
  &gt;&gt;&gt; tpr
  array([ 0.5,  0.5,  1. ,  1. ])
  &gt;&gt;&gt; thresholds
  array([ 0.8 ,  0.4 ,  0.35,  0.1 ]
  </code></pre>
  
  <p>Is there a simple way to go from this to the partial AUC?</p>
  
  <hr>
  
  <p>It seems the only problem is how to compute the tpr value at fpr = 0.1 as roc_curve doesn't necessarily give you that.</p>