1
$\begingroup$

while learning about ROC curves I got confused by the how these are made.

I am considering here the Iris flower classification problem. To calculate TPR we can use $$TPR=\frac{True \ positive}{True\ positive + \ False \ Negative }$$ Now in this case first we feed in the test data and find out the TPR and FPR by using the formulas above.But in this case how we get different array size.

>>>fpr = dict()
>>>tpr = dict()
>>>roc_auc = dict()
>>>for i in range(n_classes):
       fpr[i], tpr[i], _ = roc_curve(y_test[:, i], y_score[:, i])
       roc_auc[i] = auc(fpr[i], tpr[i])


tpr(true positive rate)
0: array([ 0.04761905,  1.        ,  1.        ]),  1: array([
0.03333333,  0.03333333,  0.1       ,  0.1       ,  0.2       ,
         0.2       ,  0.23333333,  0.23333333,  0.36666667,  0.36666667,
         0.4       ,  0.4       ,  0.7       ,  0.7       ,  0.73333333,
         0.73333333,  0.76666667,  0.76666667,  0.8       ,  0.8       ,
         0.83333333,  0.83333333,  0.86666667,  0.86666667,  0.9       ,
         0.9       ,  0.93333333,  0.93333333,  0.96666667,  0.96666667,
         1.        ,  1.        ]),  2: array([ 0.04166667,  0.79166667,  0.79166667,  0.95833333,  0.95833333,
         1.        ,  1.        ]),
$\endgroup$

closed as off-topic by Michael Chernick, Juho Kokkala, rolando2, Momo, Peter Flom May 19 '18 at 11:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Michael Chernick, rolando2, Momo, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ It is very unclear to me what you are doing. Where are these arrays coming from? In any case it sounds like a programming question more than a statistical questions: FPR and TPR do have the same size when calculated properly. $\endgroup$ – Calimo May 18 '18 at 17:23
  • $\begingroup$ Voting to close as unclear since I don't know what "how we get different array size" means $\endgroup$ – Juho Kokkala May 18 '18 at 19:01