Line | |
---|
1 | /*************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* Routine for printing confusion matrices */ |
---|
4 | /* --------------------------------------- */ |
---|
5 | /* */ |
---|
6 | /*************************************************************************/ |
---|
7 | |
---|
8 | #include "defns.i" |
---|
9 | #include "types.i" |
---|
10 | #include "extern.i" |
---|
11 | |
---|
12 | |
---|
13 | PrintConfusionMatrix(ConfusionMat) |
---|
14 | /* -------------------- */ |
---|
15 | ItemNo *ConfusionMat; |
---|
16 | { |
---|
17 | short Row, Col; |
---|
18 | |
---|
19 | if ( MaxClass > 20 ) return; /* Don't print nonsensical matrices */ |
---|
20 | |
---|
21 | /* Print the heading, then each row */ |
---|
22 | |
---|
23 | printf("\n\n\t"); |
---|
24 | ForEach(Col, 0, MaxClass) |
---|
25 | { |
---|
26 | printf(" (%c)", 'a' + Col); |
---|
27 | } |
---|
28 | |
---|
29 | printf("\t<-classified as\n\t"); |
---|
30 | ForEach(Col, 0, MaxClass) |
---|
31 | { |
---|
32 | printf(" ----"); |
---|
33 | } |
---|
34 | printf("\n"); |
---|
35 | |
---|
36 | ForEach(Row, 0, MaxClass) |
---|
37 | { |
---|
38 | printf("\t"); |
---|
39 | ForEach(Col, 0, MaxClass) |
---|
40 | { |
---|
41 | if ( ConfusionMat[Row*(MaxClass+1) + Col] ) |
---|
42 | { |
---|
43 | printf("%5d", ConfusionMat[Row*(MaxClass+1) + Col]); |
---|
44 | } |
---|
45 | else |
---|
46 | { |
---|
47 | printf(" "); |
---|
48 | } |
---|
49 | } |
---|
50 | printf("\t(%c): class %s\n", 'a' + Row, ClassName[Row]); |
---|
51 | } |
---|
52 | printf("\n"); |
---|
53 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.