public void displayConfusionMatrix() { int total = 0; int wrong = 0; System.out.print(" | "); for (Category c : categories.values()) { System.out.print(c.getCategory() + " | "); total += c.totalCategorized; wrong += c.wrong; } System.out.println(); for (Category c : categories.values()) { String out = c.getCategory() + " | "; for (String c2 : categories.keySet()) { if (c.categorized.containsKey(c2)) out += String.format("%.2f | ", c.categorized.get(c2) / (c.totalCategorized * 1.0)); else out += "0000 | "; } System.out.println(out); } System.out.println("Accuracy: " + Math.round(100 * (total - wrong * 1.0) / total) + "%"); System.out.println(); }
public void printTopTwenties() { for (Category c : categories.values()) { System.out.println("Class: " + c.getCategory()); List<String> twenty = c.topTwentyWords(); for (int i = 0; i < twenty.size(); i++) { System.out.println(i + ": " + twenty.get(i)); } System.out.println(); } }