Azzera filtri
Azzera filtri

How to find the ROC curve?

2 visualizzazioni (ultimi 30 giorni)
Nourhan
Nourhan il 22 Mar 2014
Modificato: Nourhan il 22 Mar 2014
*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 Commento
Image Analyst
Image Analyst il 22 Mar 2014
Modificato: Image Analyst il 22 Mar 2014
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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by