Esempio n. 1
0
  @Override
  public String getSummaryReport() {
    final StringBuilder sb = new StringBuilder();

    sb.append(String.format("%10s: %2.3f\n", "Accuracy", matrix.getAccuracy()));
    sb.append(String.format("%10s: %2.3f\n", "Error Rate", matrix.getErrorRate()));

    return sb.toString();
  }
Esempio n. 2
0
  @Override
  public String getDetailReport() {
    final StringBuilder sb = new StringBuilder();

    sb.append("*********************** Overall Results ***********************\n");
    sb.append(String.format("%25s: %2.3f\n", "Total instances", matrix.getTotalCount()));
    sb.append(String.format("%25s: %2.3f\n", "Total correct", matrix.getTotalCorrectCount()));
    sb.append(String.format("%25s: %2.3f\n", "Total incorrect", matrix.getTotalIncorrectCount()));
    sb.append(String.format("%25s: %2.3f\n", "Accuracy", matrix.getAccuracy()));
    sb.append(String.format("%25s: %2.3f\n", "Error Rate", matrix.getErrorRate()));
    sb.append(
        String.format(
            "%25s: %2.3f\n", "Average Class Accuracy", matrix.getAverageCategoryAccuracy()));
    sb.append(
        String.format(
            "%25s: %2.3f\n", "Average Class Error Rate", matrix.getAverageCategoryErrorRate()));
    sb.append("\n");
    sb.append("********************** Per Class Results **********************\n");
    sb.append(String.format("%s\t", "Class"));
    sb.append(String.format("%s\t", "Class Accuracy"));
    sb.append(String.format("%s\t", "Class Error Rate"));
    sb.append(String.format("%s\t", "Actual Count"));
    sb.append(String.format("%s\n", "Predicted Count"));
    for (final CLASS c : matrix.getActualCategories()) {
      sb.append(String.format("%10s\t", c));
      sb.append(String.format("%2.3f\t", matrix.getCategoryAccuracy(c)));
      sb.append(String.format("%2.3f\t", matrix.getCategoryErrorRate(c)));
      sb.append(String.format("%6f\t", matrix.getActualCount(c)));
      sb.append(String.format("%6f\n", matrix.getPredictedCount(c)));
    }

    return sb.toString();
  }