필터 지우기
필터 지우기

How to find the ROC curve?

조회 수: 2 (최근 30일)
Nourhan
Nourhan 2014년 3월 22일
편집: Nourhan 2014년 3월 22일
*Hello ,
I want to find the ROC curve in MATLAB. I have used a linear classification first using classify command and then I need to plot the ROC.*
I used this code:*
%%%%
clc close all
clear all
%% MY FEATURES
features = xlsread('ExtractedFeatures.xls');
numFeatures = 418;
%% Define ground truth
groundTruthGroup = cell(numFeatures,1); groundTruthGroup(1:351) = cellstr('normal'); groundTruthGroup(352:end) = cellstr('abnormal');
%% Select features
featureSelcted = [features(:,1),features(:,2)];
%% Run LDA
[ldaClass, ldaResubErr] = classify(featureSelcted(:,1), featureSelcted(:,2), groundTruthGroup, 'linear');
bad = ~strcmp(ldaClass,groundTruthGroup);
ldaResubErr2 = sum(bad)/numFeatures;
[ldaResubCM,grpOrder] = confusionmat(groundTruthGroup,ldaClass);
%% ROC curve
[X,Y,T,AUC] = perfcurve(featureSelcted(:,1),ldaResubErr,'normal');
plot(X,Y)
xlabel('False positive rate'); ylabel('True positive rate')
title('ROC for classification by lheogistic regression')
%%%%%%
*However, I'm having an error:
Error using perfcurve>membership (line 633) Positive class is not found in the input data.
Error in perfcurve (line 387) [W,subYnames] = membership(labels(sorted),weights(sorted),...
Error in Untitled33 (line 23) [X,Y,T,AUC] = perfcurve(featureSelcted(:,1),featureSelcted(:,2),'normal');
Can any one help me in plotting the ROC curve?
I already attached the Excel sheet.
Many thanks in advance !*
  댓글 수: 1
Image Analyst
Image Analyst 2014년 3월 22일
편집: Image Analyst 2014년 3월 22일
You forgot to post the error. You just snipped out a very small portion of it. Please post the ENTIRE error. ALL the red text , with line numbers, code statements, everything. Also, below in the Products section please list what toolboxes you used, for example what toolbox perfcurve and confusionmat are in. I don't think I have those so I won't be able to help you.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by