public static double purity(Vector<Tweet> t, String label) { double size = t.size(); double tp = 0.0; for (Tweet tw : t) { if (tw.getLabel().equals(label)) { tp++; } } return tp / size; }
public static double[] tp2(Vector<Tweet> t, String label, int actual) { double size = t.size(); double[] tp = new double[3]; for (Tweet tw : t) { if (tw.getLabel().equals(label)) { tp[0]++; } } tp[1] = tp[0] / t.size(); tp[2] = tp[0] / actual; return tp; }