@@ -5,12 +5,55 @@ public class DATA_evaluation {
55 private int [][] sortedProbability ;
66
77 private int columnCount ;
8+ private int numberOfClasses ;
89 private String [] testDataResults ;
10+ private int [][] confustionMatrix = new int [3 ][2 ];
911
1012 protected DATA_evaluation (String [] testDataResults , int columnCount , String [][][] predictedTestData , int [][] sortedProbability ) {
1113 this .testDataResults = testDataResults ;
1214 this .columnCount = columnCount ;
1315 this .predictedTestData = predictedTestData ;
1416 this .sortedProbability = sortedProbability ;
1517 }
18+
19+ protected void confusionMatrix () {
20+ System .out .println (this .testDataResults [0 ]);
21+ System .out .println (this .columnCount );
22+ System .out .println (this .predictedTestData [0 ][0 ][0 ]);
23+ System .out .println (this .predictedTestData [0 ][0 ][1 ]);
24+ System .out .println (this .predictedTestData [0 ][1 ][0 ]);
25+ System .out .println (this .predictedTestData [0 ][1 ][1 ]);
26+ System .out .println (this .predictedTestData [0 ][2 ][0 ]);
27+ System .out .println (this .predictedTestData [0 ][2 ][1 ]);
28+ System .out .println (this .sortedProbability [0 ][0 ]);
29+ System .out .println (this .sortedProbability [0 ][1 ]);
30+ System .out .println (this .sortedProbability [0 ][2 ]);
31+
32+ // Resetting the confusion matrix
33+ for (int i = 0 ; i < 3 ; i ++) {
34+ for (int j = 0 ; j < 2 ; j ++) {
35+ this .confustionMatrix [i ][j ] = 0 ;
36+ }
37+ }
38+
39+ for (int i = 0 ; i < this .columnCount ; i ++) {
40+ if (this .testDataResults [i ].equals (this .predictedTestData [i ][this .sortedProbability [i ][0 ]][0 ])) {
41+ this .confustionMatrix [this .sortedProbability [i ][0 ]][0 ]++;
42+ }
43+ else {
44+ this .confustionMatrix [this .sortedProbability [i ][0 ]][1 ]++;
45+ }
46+ }
47+
48+
49+
50+ for (int i = 0 ; i < 3 ; i ++) {
51+ for (int j = 0 ; j < 2 ; j ++) {
52+ System .out .print (this .confustionMatrix [i ][j ] + " " );
53+ }
54+ System .out .println ();
55+ }
56+
57+
58+ }
1659}
0 commit comments