Code covered by the BSD License
Dr.Rajen Bhatt (view profile)
04 Oct 2010
Computes Confusion Matrix for Multiclass Problem
Watch this File
Confusion Matrix give information on misclassification. How patterns have been classified in their actual classes against other classes for each class in a matrix form.
The author does not preallocate. This would be a faster engine (and there's probably a faster bsxfun solution)
L = length(c);
conf2 = zeros(L);
for ii = 1:L
Tii = T==ii;
S = sum(Tii);
for jj = 1:L
conf2(ii,jj) = sum ((Y==jj).*Tii)/S*100;
The help is wrong here:
"The vector RATE has two entries: the percentage of correct classifications and the total number of correct classifications."
RATE is actually returned as a scalar.