1
$\begingroup$

I've made a series of predictions with a machine learning model. I have a list y of labels and a list p of predicted probabilities such that p[i] is the predicted probability of the entry associated with y[i].

With Python's sklearn library I ran

fprs, tprs, thresholds = metrics.roc_curve(y, p)

thresholds is a list in descending order of decision thresholds, while fprs and tprs is the list of associated false positive rates and true positive rates where fprs[i] and tprs[i] are the respective rates given the decision threshold at thresholds[i].

My question is, given that thresholds is in descending order, will fprs and tprs be guaranteed to be in ascending order? I believe that as the decision threshold decreases, more and more probabilities will be marked positive, thus both rates will increase monotonically.

But I've been wrong before about things that seem obvious to me, and I'm writing a tool that must assume these lists will be sorted in ascending order, so I'd like to be sure

$\endgroup$

1 Answer 1

0
$\begingroup$

From sklearn Documentation: roc_curve returns fpr and tpr, which are increasing; and thresholds which is decreasing. Also check the examples below the definitions.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.