Here is the code that I have written to test the overal performance and the performance for each class of cells:
function p = performance ( y,t) %y is assumed to be the target vector and t is the classifier outcome, y and t should be % of the same size
p=mean(y==t);
fprintf('overal performance : %d\n' ,p);
for i=1:6
temp=mean (ismember(find(t==i),find(y==i)));
fprintf('performance for class %d is %d\n',i,temp);
end
end
usage hint:
here is my own usage with the result:
>>X=rand(721,1)<0.7;
>>t=knnclassify(features(~X,1:33),features(X,1:33),features(X,34),8);
>>performance(features(~X,34),t)
overal performance is 72.6
performance for class 1 is 87.8 % homogeneous
performance for class 2 is 76.0 %centromere
performance for class 3 is 67.8 %nucleolar
performance for class 4 is 79.4 % coarse speckled
performance for class 5 is 42.2 %fine speckled
performance for class 6 is 1.00 %cytoplasmaticNice code. Thank you and two comments;
1) The second measure of performance that you coded is literately called
"sensitivity". So you can say e.g. "The sensitivity of the classifier on
homogeneous samples is %87.8" or "The classifier is less sensitive on
cytoplasmaic samples" and so on. It is also called "recall" in IR
terminology. For example, you can say "The classifier recalls %87.8 of
homogeneous samples". The first measure is simply called "accuracy".
2) Had you have a cell array of class labels? If not simply you can
create one by
classLabels={'homogeneous', 'centromere', 'nucleolar', 'coarse
speckled', 'fine speckled', 'cytoplasmic'}
and call classLabels(i) in your codes for the convenient.