コード例 #1
0
  public void printPerformance(InstanceList instanceList, String description) {
    System.out.println(description);
    System.out.println("Accuracy: " + classifier.getAccuracy(instanceList));
    LabelAlphabet labelAlphabet = classifier.getLabelAlphabet();
    Iterator iterator = labelAlphabet.iterator();
    while (iterator.hasNext()) {
      Object label = iterator.next();
      double p = classifier.getPrecision(instanceList, label);
      double r = classifier.getRecall(instanceList, label);
      double f1 = classifier.getF1(instanceList, label);

      System.out.println("Precision[" + label + "] = " + p);
      System.out.println("Recall[" + label + "] = " + r);
      System.out.println("F1[" + label + "] = " + f1);
      System.out.println("");
    }

    ExtendedTrial trial = new ExtendedTrial(classifier, instanceList);
    System.out.println("Overall performance\n=====");
    System.out.println("Precision: " + trial.getPrecision());
    System.out.println("Recall: " + trial.getRecall());
    System.out.println("F1: " + trial.getF1());
    System.out.println("Fall-out: " + trial.getFallOut());

    trial.showErrors();
  }