<p dir="auto"><strong>Proposed feature</strong></p>
<p dir="auto">I have often had to use interpolation to plot the mean ROC or PR curves of several classifiers, as the number of thresholds can be distinct for each und thus their TPR, FPR, precision, and recall lengths vary. I thought it would be convenient to add a function argument "interp_dim" to the functions "roc_curve" and "precision_recall_curve" so the user can ensure that all classifier metrics have the same lengths, which would make it easier to plot the average.</p>
<p dir="auto"><strong>Proposed solution</strong></p>
<p dir="auto">Perform numpy interpolation on TPR, FPR, precision and recall arrays to ensure they have the same length (as specified by the "interp_dim" function argument), which simplifies the computation of the mean.</p>
<p dir="auto">I opened this issue to see if this idea receives support from the community before making a pull request.</p>
<p dir="auto">Hi,</p>
<p dir="auto">Scikit Learn seems to implement Precision Recall curves (and Average Precision values/AUC under PR curve) in a non-standard way, without documenting the discrepancy. The standard way of computing Precision Recall numbers is by interpolating the curve, as described here:<br>
<a href="http://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-ranked-retrieval-results-1.html" rel="nofollow">http://nlp.stanford.edu/IR-book/html/htmledition/evaluation-of-ranked-retrieval-results-1.html</a><br>
the motivation is to</p>
<ol dir="auto">
<li>Smooth out the kinks and reduce noise contribution to the score</li>
<li>In any practical application, if your PR curve ever went up, then you would strictly prefer to set your threshold there rather than at the original place (achieving both more precision and recall). Hence, people prefer to interpolate the curve, which better integrates out the threshold parameter and gives a more sensible estimate of the real performance.</li>
</ol>
<p dir="auto">This is also what standard code for Pascal VOC does and explain this in their writeup:<br>
<a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.157.5766&amp;rep=rep1&amp;type=pdf" rel="nofollow">http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.157.5766&amp;rep=rep1&amp;type=pdf</a></p>
<p dir="auto">VL_FEAT also has options for interpolation:<br>
<a href="http://www.vlfeat.org/matlab/vl_pr.html" rel="nofollow">http://www.vlfeat.org/matlab/vl_pr.html</a><br>
and as shown in their code here: <a href="https://github.com/vlfeat/vlfeat/blob/edc378a722ea0d79e29f4648a54bb62f32b22568/toolbox/plotop/vl_pr.m">https://github.com/vlfeat/vlfeat/blob/edc378a722ea0d79e29f4648a54bb62f32b22568/toolbox/plotop/vl_pr.m</a></p>
<p dir="auto">The concern is that people using the scikit version will see incorrectly reported LOWER performance, than what they might see reported in other papers.</p>