MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / getScore

Method getScore

JSAT/src/jsat/classifiers/evaluation/Kappa.java:53–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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)

Callers 1

testGetScoreMethod · 0.95

Calls 5

rowsMethod · 0.45
sumMethod · 0.45
getRowViewMethod · 0.45
getColumnViewMethod · 0.45
getMethod · 0.45

Tested by 1

testGetScoreMethod · 0.76