MATLAB Answers

confusion matrix is *confusing* for ensamble classifers;

1 view (last 30 days)
Swarup
Swarup on 15 Jan 2015
Edited: Swarup on 19 Jan 2015
Hi everyone,
I am working with matlab version 2013b. I use fitensamble for segmentation.
The procedure is as follows. 1) I read the file, and visualize it. 2) I create feature vector by hand picking certain relevant pixels ranges and create labels(Clus) corresponding to these pixels.
P=[]; SIZE= length(x); for i=1:Clus, P = [P ; i*ones(round(SIZE/Clus),1)]; end
3) I presume their is certain mislabeling arising. 4) Thereafter I train the classifier with using the chosen pixels and labels with minileaf 5 and learnrate 0.1 and segment rest of the slices using this ensemble.
5)The classifier is trained using 600 pixels (stored in x and label P) and subjected to unknow pixel data of 2449365 (in w).
whos x w Name Size Bytes Class Attributes
w 2449365x1 19594920 double
x 600x1 4800 double
In the end I get a segmented image but unable to plot confusion matrix.
can you guys please comment or suggest
%confusion Matrix
tic, for i=1:1
disp(sprintf('classifying slice no. %d....',i));
s=sprintf('Slice: % d', i');
R=double(AA(:,:,i));
[r,c,v]=find(R>0);
cyl=R>0;
R1=cyl.*R;
[m, n, w]=find(R1);
Yfit = predict(bagTree,w);
Yfits = predict(rusTree,w);
end; toc,
tab = tabulate(P)
bsxfun(@rdivide,confusionmat(w,Yfit),tab(:,2))*100
Error using bsxfun
Non-singleton dimensions of the two input arrays must match each other.
>> tab
tab =
1 150 25
2 150 25
3 150 25
4 150 25
whos w Yfit tab Name Size Bytes Class Attributes
Yfit 2449365x1 19594920 double
tab 4x3 96 double
w 2449365x1 19594920 double

Answers (0)

Community Treasure Hunt

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

Start Hunting!