필터 지우기
필터 지우기

Plotting ROC curve from confusion matrix

조회 수: 18 (최근 30일)
farheen asdf
farheen asdf 2016년 11월 3일
댓글: Greg Heath 2017년 12월 22일
I have used knn to classify 86 images into 2 classes. I have found the confusion matrix and accuracy using matlab commands confusionmat and classperf. How do I find the ROC curve? I know it is a ratio of true positive rate and false positive rate at all possible thresholds, but how do I calculate it when I only have confusion matrix to play with? I have banged my head for weeks over theory of ROC but still am no where close to actually plotting it. Please if someone could guide me with respect to plotting it on matlab and not the theory behind it, that would be great.

채택된 답변

Hazem
Hazem 2016년 12월 15일
It is challenging but not impossible. The main idea is to get more confusion matrices, hence points on the ROC curve. If you had scores associated with each image, you could use directly the perfcurve function https://www.mathworks.com/help/stats/perfcurve.html
So the challenge is to assign scores to your 86 images, each of which would tell how close the image is to the true class. Some classifiers return that score, but not K-NN as far as I understand it. Here is one suggestion how you can decide those scores, but you can come up with your own method. http://stackoverflow.com/questions/13642390/knn-classification-in-matlab-confusion-matrix-and-roc?rq=1

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 11월 3일
You can't. One confusion matrix can get you only one point on the ROC curve. To get other points, you'd have to adjust other things in your algorithm (like threshold or whatever) to get different true positive rates (different confusion matrices). For example, you'd have to run your algorithm on different set of images, or take subsets of the one you have (set of 86 images) as a worst case.
  댓글 수: 3
Image Analyst
Image Analyst 2016년 11월 4일
I don't know. I'm not familiar with ann.
Greg Heath
Greg Heath 2017년 12월 22일
The typical ROC is obtained FOR A SINGLE CLASS vs ALL OTHER CLASSES by varying the classification threshold.
However, when there are only two classes, one ROC will suffice.
Hope this helps.
Greg

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Detection에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by