thresholds in roc_curve in scikit learn
<p>I am referring to the below link and sample, and post the plot diagram from this page where I am confused. My confusion is, there are only 4 threshold, but it seems the roc curve has many data points (> 4 data points), wondering how roc_curve working underlying to find more data points?</p>

<p><a href="http://scikit-learn.org/stable/modules/model_evaluation.html#roc-metrics" rel="nofollow">http://scikit-learn.org/stable/modules/model_evaluation.html#roc-metrics</a></p>

<pre><code>&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; from sklearn.metrics import roc_curve
&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 = 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><a href="http://i.stack.imgur.com/s3AVy.png" rel="nofollow"><img src="http://i.stack.imgur.com/s3AVy.png" alt="enter image description here"></a></p>

<p>That plot is actually from this example: <a href="http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html" rel="nofollow">http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html</a></p>

python python-2.7 machine-learning scikit-learn roc