Examples of DawidSkeneDecorator


Examples of com.ipeirotis.gal.decorator.DawidSkeneDecorator

  }

  public void reportConfusionMatrix(ReportingContext ctx, ReportTarget reportTarget) {

    DawidSkene ds = ctx.getDawidSkene();
    DawidSkeneDecorator decorator = new DawidSkeneDecorator(ds);

    String type = "Estimated";

    for (ClassificationMethod estimatedClasMethod : Datum.ClassificationMethod.values()) {
     
     
      ConfusionMatrix confMatrix = decorator.getEstimatedConfusionMatrix(estimatedClasMethod);

      reportTarget.println("%s Confusion Matrix (%s):", type, estimatedClasMethod.name());

      for (String from : confMatrix.getCategoryNames()) {
        for (String to : confMatrix.getCategoryNames()) {
          Double cm_entry = confMatrix.getErrorRate(from, to);
          String s_cm_entry = Double.isNaN(cm_entry) ? "---" : Helper.round(100 * cm_entry, 3).toString();
          reportTarget.print("P[%s->%s]=%s%%\t", from, to, s_cm_entry);
        }
        reportTarget.println("");
      }
      reportTarget.println("");
    }

    type = "Actual";

    // for each classification method, we need to create a confusion matrix
    for (ClassificationMethod clasMethod : Datum.ClassificationMethod.values()) {
      ConfusionMatrix confMatrix = decorator.getConfusionMatrix(clasMethod);

      reportTarget.println("%s Confusion Matrix (%s):", type, clasMethod.name());

      for (String from : confMatrix.getCategoryNames()) {
        for (String to : confMatrix.getCategoryNames()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.