how to use the perfcurve for ROC that has already been built
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi I have used the following listing of code to create an ROC curve based on some testing that I had carried out. I was wanting to use the perfcurve to get the AUC and some other statistics on the ROC curve. Is it possible to use the perfcurve on an ROC curve that has already been created or if not could someone provide me with help on how to use the perfcurve function on what I already have.
Kmax =max(max(Finalprobs')) %set Kmax
Kmin = 0; %set Kmin
K=linspace(Kmin,Kmax,1000) ; %create 1000 K values evenly between Kmin and Kmax
Result1 =zeros(numel(K), 4); %create array "Result1"
for iK = 1:numel(K) %start of for loop iK
aK =K(iK); %set aK to increment through the values of K
TP=0;
TN=0;
FP=0;
FN=0;
for confuseloopCO = 1:size(Finalprobs, 2) %for loop for TN and FP
if (Finalprobs(1,confuseloopCO)) > aK
TN=TN+1;
else
FP=FP+1;
end
if (Finalprobs(2,confuseloopCO)) > aK %for loop for FN and TP
FN=FN+1;
else
TP=TP+1;
end
end
Result1(iK,:) = [TP, FN, FP, TN]; %insert values of TP,FN,FP,TN into
%Result1 during for loop iK
end
sens = Result1(:,1)/1000
spec = Result1(:,4)/1000
x = (1-spec)
y = (sens)
figure 1;
plot(x,y,'r')
title('ROC Curve for QTc Data with Control Probability', 'FontSize', 16)
xlabel('1-Specificity', 'FontSize', 14)
ylabel('Sensitivity', 'FontSize', 14)
If needs be in can upload the entire code being used but it is rather long.
Cheers,
Ross
Further to this I have been able to use the trapz function to work out the area under the curve but would like to be able to perform the perfcurve on the data if at all possible.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu ROC - AUC finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!