Jul 9, 2013

Confusin matrix

% compute and display test error
num_classes = 4;
y = [1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4]';
pred_l = [1 1 2 3 2 2 3 4 3 3 4 1 4 4 1 2]';
conf_matrix = zeros(num_classes, num_classes);
for c = 1:num_classes  
    indices = find(y==c);
    for c2 = 1:num_classes
        conf_matrix(c, c2) = sum(pred_l(indices)==c2);
    end
    disp([c ' error: ' num2str(sum(pred_l(indices)~=c))]);
end
disp('Confusion Matrix: ');
disp(num2str(conf_matrix));

No comments:

Down with the Dictatorship!

    "Let them hate me, so that they fear me" - Caligula 41AD