can somebody help me to generate a confusion matrix for this multisvm code?

9 ビュー (過去 30 日間)
Hadeer tawfik
Hadeer tawfik 2016 年 10 月 22 日
コメント済み: kokeb Dese 2018 年 8 月 9 日
I have been trying to plot a confusion matrix for this svm code but im reaching nowhere,so the purpose of my code is to classify my 95 images into 3 classes, i have made the training_label which is the label of every image.then i don't know how to generate the confusion matrix. here is the code
close all
clear all
clc
srcFiles = dir('E:\sense\cata2\cata\all\*.jpg');
for i = 1 : length(srcFiles)
filename = strcat('E:\sense\cata2\cata\all\',srcFiles(i).name);
Img = imread(filename);
Img = imresize(Img,[256,256]);
%figure, imshow(Img); title('Image');
% Enhance Contrast
I = imadjust(Img,stretchlim(Img));
figure, imshow(I);title('Contrast Enhanced');
% Extract Features from query image
[Feature_Vector] = Extract_FeaturesofSoilforall(I);
whos Feature_Vector
% Load Training Features
[X,T] = cataractdataset;
TrainFeat = X;
Train_Label = T;
test = Feature_Vector;
result = multisvm(TrainFeat,Train_Label,test)
disp(result)
if result == 1
helpdlg(' grade1');
disp(' grade1 ');
elseif result == 2
helpdlg(' last ');
disp('last');
elseif result == 3
helpdlg('normal');
disp(' normal ');
end
confMat = confusionmat(,test )
end

採用された回答

Hadeer tawfik
Hadeer tawfik 2016 年 10 月 23 日
confMat = confusionmat(Train_Label, results)
  2 件のコメント
Hadeer tawfik
Hadeer tawfik 2016 年 10 月 23 日
編集済み: Hadeer tawfik 2016 年 10 月 23 日
This worked for me hince: results is a vector that contains the classifier results.
kokeb Dese
kokeb Dese 2018 年 8 月 9 日
This is very interesting, but what if it is for all testing data confusion matrix together.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by