| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public double getScore() |
| 55 | { |
| 56 | double[] rowTotals = new double[errorMatrix.rows()]; |
| 57 | double[] colTotals = new double[errorMatrix.rows()]; |
| 58 | for(int i = 0; i < errorMatrix.rows(); i++) |
| 59 | { |
| 60 | rowTotals[i] = errorMatrix.getRowView(i).sum(); |
| 61 | colTotals[i] = errorMatrix.getColumnView(i).sum(); |
| 62 | } |
| 63 | |
| 64 | double chanceAgreement = 0; |
| 65 | double accuracy = 0; |
| 66 | double totalCount = 0; |
| 67 | for(int i = 0; i < rowTotals.length; i++) |
| 68 | { |
| 69 | chanceAgreement += rowTotals[i]*colTotals[i]; |
| 70 | totalCount += rowTotals[i]; |
| 71 | accuracy += errorMatrix.get(i, i); |
| 72 | } |
| 73 | chanceAgreement /= totalCount*totalCount; |
| 74 | accuracy /= totalCount; |
| 75 | |
| 76 | return (accuracy-chanceAgreement)/(1-chanceAgreement); |
| 77 | } |
| 78 | |
| 79 | @Override |
| 80 | public boolean equals(Object obj) |