@Test public void testGetMatrix() { ConfusionMatrix confusionMatrix = fillConfusionMatrix(VALUES, LABELS, DEFAULT_LABEL); Matrix m = confusionMatrix.getMatrix(); Map<String, Integer> rowLabels = m.getRowLabelBindings(); assertEquals(confusionMatrix.getLabels().size(), m.numCols()); assertTrue(rowLabels.keySet().contains(LABELS[0])); assertTrue(rowLabels.keySet().contains(LABELS[1])); assertTrue(rowLabels.keySet().contains(DEFAULT_LABEL)); assertEquals(2, confusionMatrix.getCorrect(LABELS[0])); assertEquals(20, confusionMatrix.getCorrect(LABELS[1])); assertEquals(0, confusionMatrix.getCorrect(DEFAULT_LABEL)); }
public Matrix getMatrix() { int length = confusionMatrix.length; Matrix m = new DenseMatrix(length, length); for (int r = 0; r < length; r++) { for (int c = 0; c < length; c++) { m.set(r, c, confusionMatrix[r][c]); } } Map<String,Integer> labels = new HashMap<>(); for (Map.Entry<String, Integer> entry : labelMap.entrySet()) { labels.put(entry.getKey(), entry.getValue()); } m.setRowLabelBindings(labels); m.setColumnLabelBindings(labels); return m; }
ConfusionMatrix { public Matrix getMatrix() { int length = confusionMatrix.length; Matrix m = new DenseMatrix(length, length); for (int r = 0; r < length; r++) { for (int c = 0; c < length; c++) { m.set(r, c, confusionMatrix[r][c]); } } Map<String,Integer> labels = new HashMap<>(); for (Map.Entry<String, Integer> entry : labelMap.entrySet()) { labels.put(entry.getKey(), entry.getValue()); } m.setRowLabelBindings(labels); m.setColumnLabelBindings(labels); return m; } }
ConfusionMatrix { public Matrix getMatrix() { int length = confusionMatrix.length; Matrix m = new DenseMatrix(length, length); for (int r = 0; r < length; r++) { for (int c = 0; c < length; c++) { m.set(r, c, confusionMatrix[r][c]); } } Map<String,Integer> labels = new HashMap<>(); for (Map.Entry<String, Integer> entry : labelMap.entrySet()) { labels.put(entry.getKey(), entry.getValue()); } m.setRowLabelBindings(labels); m.setColumnLabelBindings(labels); return m; } ConfusionMatrix(Collection<String> labels, String defaultLabel);  ConfusionMatrix(Matrix m); }
ConfusionMatrix { public Matrix getMatrix() { int length = confusionMatrix.length; Matrix m = new DenseMatrix(length, length); for (int r = 0; r < length; r++) { for (int c = 0; c < length; c++) { m.set(r, c, confusionMatrix[r][c]); } } Map<String,Integer> labels = new HashMap<>(); for (Map.Entry<String, Integer> entry : labelMap.entrySet()) { labels.put(entry.getKey(), entry.getValue()); } m.setRowLabelBindings(labels); m.setColumnLabelBindings(labels); return m; } ConfusionMatrix(Collection<String> labels, String defaultLabel);  ConfusionMatrix(Matrix m); int[][] getConfusionMatrix(); Collection<String> getLabels(); double getAccuracy(String label); double getAccuracy(); double getPrecision(String label); double getWeightedPrecision(); double getRecall(String label); double getWeightedRecall(); double getF1score(String label); double getWeightedF1score(); double getReliability(); double getKappa(); RunningAverageAndStdDev getNormalizedStats(); int getCorrect(String label); int getTotal(String label); void addInstance(String correctLabel, ClassifierResult classifiedResult); void addInstance(String correctLabel, String classifiedLabel); int getCount(String correctLabel, String classifiedLabel); void putCount(String correctLabel, String classifiedLabel, int count); String getDefaultLabel(); void incrementCount(String correctLabel, String classifiedLabel, int count); void incrementCount(String correctLabel, String classifiedLabel); ConfusionMatrix merge(ConfusionMatrix b); Matrix getMatrix(); void setMatrix(Matrix m); @Override String toString(); }
ConfusionMatrix { public Matrix getMatrix() { int length = confusionMatrix.length; Matrix m = new DenseMatrix(length, length); for (int r = 0; r < length; r++) { for (int c = 0; c < length; c++) { m.set(r, c, confusionMatrix[r][c]); } } Map<String,Integer> labels = new HashMap<>(); for (Map.Entry<String, Integer> entry : labelMap.entrySet()) { labels.put(entry.getKey(), entry.getValue()); } m.setRowLabelBindings(labels); m.setColumnLabelBindings(labels); return m; } ConfusionMatrix(Collection<String> labels, String defaultLabel);  ConfusionMatrix(Matrix m); int[][] getConfusionMatrix(); Collection<String> getLabels(); double getAccuracy(String label); double getAccuracy(); double getPrecision(String label); double getWeightedPrecision(); double getRecall(String label); double getWeightedRecall(); double getF1score(String label); double getWeightedF1score(); double getReliability(); double getKappa(); RunningAverageAndStdDev getNormalizedStats(); int getCorrect(String label); int getTotal(String label); void addInstance(String correctLabel, ClassifierResult classifiedResult); void addInstance(String correctLabel, String classifiedLabel); int getCount(String correctLabel, String classifiedLabel); void putCount(String correctLabel, String classifiedLabel, int count); String getDefaultLabel(); void incrementCount(String correctLabel, String classifiedLabel, int count); void incrementCount(String correctLabel, String classifiedLabel); ConfusionMatrix merge(ConfusionMatrix b); Matrix getMatrix(); void setMatrix(Matrix m); @Override String toString();  }