sir, following is the error in my program, here AUC (area under curve) is 0 0 and OPTROCPT also zero why so this...
1 回表示 (過去 30 日間)
古いコメントを表示
clc
clear all;
c=[];
addpath train;
addpath test;
mapping=getmapping(8,'u2'); %LBP
W=[0,0,0,0,0,0,0; ...
0,1,1,1,1,1,0; ...
0,1,2,4,2,1,0; ...
0,1,4,4,4,1,0; ...
0,1,2,4,2,1,0; ...
0,1,1,1,1,1,0; ...
0,0,0,0,0,0,0];
%%Training images
for folder_idx = 1 : 10 % no of classes
for i = 1 : 9 % no of images per class
thisfile = fullfile('train', num2str(folder_idx), [num2str(i) '.bmp ']);
B = imread(thisfile );
X = double(B);
X = imresize(X,[60 60],'bilinear');
H2=DSLBP(X,mapping,W);
Gray=X;
Gray=(Gray-mean(Gray(:)))/std(Gray(:))*20+60;
lpqhist=lpq(Gray,3,1,1,'nh');
% imshow(lpqhist);
a=[H2,lpqhist];
c=[c;a];
disp(sprintf('Done',i));
end
end
%%Testing images
d=[];
for folder_idx = 1 : 10 %no of classes
for i = 1 : 3 % no of images per class
thisfile = fullfile('test', num2str(folder_idx), [num2str(i) '.bmp ']);
B = imread(thisfile );
X = double(B);
X = imresize(X,[60 60],'bilinear');
H2=DSLBP(X,mapping,W);
Gray=X;
Gray=(Gray-mean(Gray(:)))/std(Gray(:))*20+60;
lpqhist=lpq(Gray,3,1,1,'nh');
a=[H2,lpqhist];
d=[d;a];
disp(sprintf('Done',i));
end
end
P_train=c;
P_test=d;
% %%PCA low dimension reduction
%
P_train = P_train';
% if classes are 20 then eiganvectors not exceed then 179
model = perform_pca(P_train,89); %rank(P_train)-1
test_features= linear_subspace_projection(P_test, model, 1);
P_train=model.train';
P_test=test_features';
%%Normalisation
% P_train=P_train/256;
% P_test=P_test/256;
%%%%%%%%load label %%%%%%%%%%%%
train_label=load('train_label.txt');
test_label=load('test_label.txt');
predictlabel = knnclassify(P_test, P_train, train_label,3,'euclidean','nearest');
cp = classperf(test_label,predictlabel);
cp.CorrectRate*100
% Multiclass demo
disp('_____________Multiclass demo_______________')
disp('Runing Multiclass confusionmat')
[c_matrix,Result,RefereceResult]= confusion.getMatrix(test_label,predictlabel);
[FPR, TPR,Thr, AUC, OPTROCPT] = perfcurve(predictlabel, test_label,1)
% %
%plot(TPR,FPR,'--rs','LineWidth',2,'MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',10)
figure,
plot(TPR,FPR,'r-','LineWidth',4);
xlabel('False positive rate')
ylabel('True positive rate')
title('ROC Curve for Classification ')
Tbl = table(FPR, TPR,Thr)
%
%
%%FAR = FPR = FP/(FP + TN) and FRR = FNR = FN/(FN + TP)
[FPR, FNR,Thr] = perfcurve(predictlabel, test_label,1,'xCrit','FPR','yCrit','FNR','TVals','all')
Thr = Thr/10;
figure,
plot(Thr,FPR,'r--','LineWidth',2,'MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',10);
xlabel('Threshold')
ylabel('False positive rate / FAR')
title('ROC Curve for Classification ')
figure,
plot(Thr,FNR,'r--','LineWidth',2,'MarkerEdgeColor','k','MarkerFaceColor','g','MarkerSize',10);
xlabel('Threshold')
ylabel('False Negative rate / FRR')
title('ROC Curve for Classification ')
Tbl = table(FPR, FNR)
2 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!