Sep 24, 2014

confusion matrix matlab

tl =
     1     1     1
     1     1     2
     2     2     2

pl =

     1     1     1
     2     1     1
     2     2     2

>> confusionmat(double(tl(:)), double(pl(:)), 'order', 1:2+1)

ans =

     4     1     0
     1     3     0
     0     0     0


>> conf_mat = confusionmat(double(tl(:)), double(pl(:)), 'order', 1:2)

conf_mat =

     4     1
     1     3

>> sum(conf_mat, 2)

ans =

     5
     4

>> nrm(:,ones(1,size(conf_mat,2)))

ans =

     5     5
     4     4

>> conf_mat./nrm(:, ones(1,size(conf_mat,2)))

ans =

    0.8000    0.2000
    0.2500    0.7500

No comments:

Carlo Cipolla's Laws of Stupidity

    "By creating a graph of Cipolla's two factors, we obtain four groups of people. Helpless people contribute to society but are...