我正在尝试创建一个混乱矩阵:
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
时,我不确定用于参数的targets
和outputs
。
我尝试使用order
作为targets
和C
作为outputs
,但这似乎不起作用。
我在正确的轨道上吗?
使用C = plotConfusion(testing_vector, predicted_labels);
confusionmat
在plotConfusion
内被调用。和输出C
是从confusionmat
生成的repmat
转换。有关更多详细信息,请参见其源代码。