2014-01-26 430 views
0

我试图创建一个混淆矩阵:混淆绘制混淆矩阵MATLAB

http://en.wikipedia.org/wiki/Confusion_matrix

到目前为止,我已经预测标签的清单(例如:[1,2,4,5, 1])和测试标签(例如[1,2,5,6,1])。

但是,我遇到了为混淆矩阵创建情节的问题。

我可以生成一个与

[C,order] = confusionmat(testing_vector, predicted_labels) 


C = 

     933   0   7   5   3   9   13   2   7   1 
      0  1104   5   2   1   1   4   1   16   1 
      8   7   885   31   10   3   16   15   55   2 
      10   1   25   887   5   31   2   13   22   14 
      5   1   9   5   876   2   12   5   19   48 
      11   6   8   47   12   719   15   12   50   12 
      13   3   12   3   9   26   879   0   12   1 
      2   11   17   7   9   1   0   926   12   43 
      11   18   11   31   13   48   8   12   799   23 
      11   7   5   13   45   5   1   41   31   850 


order = 

    0 
    1 
    2 
    3 
    4 
    5 
    6 
    7 
    8 
    9 

但是,当我尝试使用plotconfusion,我不确定如何使用的参数targetsoutputs

我试过order作为targetsC作为outputs但这似乎不起作用。

我在正确的轨道上吗?

+0

只是为了记录,也许你会发现这[代码](http://stackoverflow.com/questions/21215352/matlab-confusion-matrix)有用:) – Darkmoor

回答

2

使用C = plotConfusion(testing_vector, predicted_labels);confusionmatplotConfusion内部被调用。并输出C是从confusionmat产生的一个repmat变换。有关更多详细信息,请参阅其source code