添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams [X,Y,T,AUC] = perfcurve(labels,scores,posclass)

I am confused about the following. first a basic example and then I ll followup with my question

a) [X,Y,T,AUC] = perfcurve([1 1 1 0 0 0],[.9 .9 .9 .1 .1 .1],1) produces AUC = 1

b) [X,Y,T,AUC] = perfcurve([0 0 0 1 1 1],[.9 .9 .9 .1 .1 .1],1) produces AUC = 0

  • when I provide the positive class(laebl=1) does it always have to have the higher scores?
  • If I make the positive class(label=1) have lower scores as in b) above would the ROC curve be flipped (mirror opposite of the normal ROC curve)
  • The curves I generate with my data looks like below. plot 1 is the distribution of the scores.The classes are shown in red and blue. Notice that the label=1 (red) class has low scores. red -> label=1 blue-> label=0

    The next image is the generated ROC curve. It's basically a flipped image of what I want to see. Am I doing something wrong? or is this behavior related to the label=1 class having low scores?

    When you write the 1 in the third argument, you define the class label to be assumed as positive (1), and then perfcurve calculates fpr and tpr by looking at the probabilites/scores you provide in the second argument, in relation to the positive class label as you defined it (1). The score for each data defines if it is a TP or a FP (you already defined the positive class), so if you exchange scores as you show above, without changing the class label of the positive class also, each TP becomes a FP, since now is at the opposite side of the thresholds used to calculate ROC curve. That's why the plot is a mirror image of what you expect.

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question . Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers .