<NME> Displayer.java
<BEF> package edu.neu.ccs.pyramid.calibration;

import edu.neu.ccs.pyramid.util.Pair;

import java.text.DecimalFormat;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Displayer {

    /**
     *
     * @param stream containing calibrated confidence
     * @return
     */
    public static String displayCalibrationResult(Stream<Pair<Double, Double>> stream){
        final int numBuckets = 10;
        BucketInfo total = BucketInfo.aggregate(stream, numBuckets,0,1);
        double[] counts = total.getCounts();
        double[] correct = total.getSumLabels();
        double[] sumProbs = total.getSumProbs();
        double[] accs = new double[counts.length];
        double[] average_confidence = new double[counts.length];

        double datasetSize = 0;

        for (int i = 0; i < counts.length; i++) {
            accs[i] = correct[i] / counts[i];
            datasetSize += counts[i];
        }
        for (int j = 0; j < counts.length; j++) {
            average_confidence[j] = sumProbs[j] / counts[j];
        }

        DecimalFormat decimalFormat = new DecimalFormat("#0.0000");
        DecimalFormat df = new DecimalFormat("#0.0%");
        StringBuilder sb = new StringBuilder();
        sb.append("interval\t\t").append("total\t\t\t").append("correct\t\t").append("incorrect\t").append("accuracy\t").append("average_confidence\n");
        for (int i = 0; i < 10; i++) {
            sb.append("[").append(decimalFormat.format(i * 0.1)).append(",")
                    .append(decimalFormat.format((i + 1) * 0.1)).append("]")
                    .append("\t\t").append(counts[i]).append(" (").append(df.format((counts[i]/datasetSize))).append(")").append("\t\t").append(correct[i]).append("\t\t")
                    .append(counts[i] - correct[i]).append("\t\t");
                    if (Double.isFinite(accs[i])){
                        sb.append(decimalFormat.format(accs[i])).append("\t\t");
                    } else {
                        sb.append("N/A").append("\t\t");
                    }

                    if (Double.isFinite(average_confidence[i])){
                        sb.append(decimalFormat.format(average_confidence[i])).append("\n");
                    } else {
                        sb.append("N/A").append("\n");
                    }

        }

        String result = sb.toString();
        return result;

    }



        Comparator<Pair<Double, Integer>> comparator = Comparator.comparing(pair->pair.getFirst());
        List<Pair<Double,Integer>> list = stream.sorted(comparator.reversed()).collect(Collectors.toList());
        int sumCorrect = 0;
        double confidenceThreshold = 0;
        double autocodePercentage = 0;
        int size = list.size();
        Pair<Double, Double> result =new Pair<>();
        double[] average_confidence = new double[counts.length];

        double datasetSize = 0;

        for (int i = 0; i < counts.length; i++) {
            averageF1[i] = sumF1[i] / counts[i];
            datasetSize += counts[i];
        }
        for (int j = 0; j < counts.length; j++) {
            average_confidence[j] = sumProbs[j] / counts[j];
        }

        DecimalFormat decimalFormat = new DecimalFormat("#0.0000");
        DecimalFormat df = new DecimalFormat("#0.0%");
    }


    public static Pair<Double,Double> autocodingPercentageForAccuraccyTarget(Stream<Pair<Double, Integer>> stream, double confidenceThreshold){

        List<Pair<Double,Integer>> list = stream.collect(Collectors.toList());
        int sum = 0;
                sb.append(decimalFormat.format(averageF1[i])).append("\t\t");
            } else {
                sb.append("N/A").append("\t\t");
            }

            if (Double.isFinite(average_confidence[i])){
                sb.append(decimalFormat.format(average_confidence[i])).append("\n");
                }
            }
        }
        Pair<Double,Double> pair =new Pair<>();
        pair.setFirst((sum*1.0)/size);
        pair.setSecond((correct*1.0)/sum);
        return pair;
    }





    public static String displayCalibrationResult(Stream<Pair<Double, Integer>> stream, int numBuckets){
        BucketInfo total = BucketInfo.aggregate(stream, numBuckets,0,1);
        double[] counts = total.getCounts();
    public static String displayCalibrationResult(Stream<Pair<Double, Double>> stream, int numBuckets){
        BucketInfo total = BucketInfo.aggregate(stream, numBuckets,0,1);
        double[] counts = total.getCounts();
        double[] correct = total.getSumLabels();
        double[] sumProbs = total.getSumProbs();
        double[] accs = new double[counts.length];
        double[] average_confidence = new double[counts.length];

        for (int i = 0; i < counts.length; i++) {
            accs[i] = correct[i] / counts[i];
        }
        for (int j = 0; j < counts.length; j++) {
            average_confidence[j] = sumProbs[j] / counts[j];
        }

        DecimalFormat decimalFormat = new DecimalFormat("#0.0000");
        StringBuilder sb = new StringBuilder();
        sb.append("interval\t\t").append("total\t\t").append("correct\t\t").append("incorrect\t\t").append("accuracy\t\t").append("average confidence\n");
        for (int i = 0; i < numBuckets; i++) {
            sb.append("[").append(decimalFormat.format(i * 1.0/numBuckets)).append(",")
                    .append(decimalFormat.format((i + 1) * 1.0/numBuckets)).append("]")
                    .append("\t\t").append(counts[i]).append("\t\t").append(correct[i]).append("\t\t")
                    .append(counts[i] - correct[i]).append("\t\t");
            if (Double.isFinite(accs[i])){
                sb.append(decimalFormat.format(accs[i])).append("\t\t");
            } else {
                sb.append("N/A").append("\t\t");
            }

            if (Double.isFinite(average_confidence[i])){
                sb.append(decimalFormat.format(average_confidence[i])).append("\n");
            } else {
                sb.append("N/A").append("\n");
            }

        return result;

    }
}

<MSG> fix a bug in tuning CTAT; made some changes to the config file

<DFF> @@ -67,7 +67,7 @@ public class Displayer {
         Comparator<Pair<Double, Integer>> comparator = Comparator.comparing(pair->pair.getFirst());
         List<Pair<Double,Integer>> list = stream.sorted(comparator.reversed()).collect(Collectors.toList());
         int sumCorrect = 0;
-        double confidenceThreshold = 0;
+        double confidenceThreshold = 1;
         double autocodePercentage = 0;
         int size = list.size();
         Pair<Double, Double> result =new Pair<>();
@@ -88,7 +88,7 @@ public class Displayer {
     }
 
 
-    public static Pair<Double,Double> autocodingPercentageForAccuraccyTarget(Stream<Pair<Double, Integer>> stream, double confidenceThreshold){
+    public static CTATresult autocodingPercentageForAccuraccyTarget(Stream<Pair<Double, Integer>> stream, double confidenceThreshold){
 
         List<Pair<Double,Integer>> list = stream.collect(Collectors.toList());
         int sum = 0;
@@ -102,16 +102,17 @@ public class Displayer {
                 }
             }
         }
-        Pair<Double,Double> pair =new Pair<>();
-        pair.setFirst((sum*1.0)/size);
-        pair.setSecond((correct*1.0)/sum);
-        return pair;
+        CTATresult ctaTresult = new CTATresult();
+        ctaTresult.autocodingPercent = (sum*1.0)/size;
+        ctaTresult.autocodingAccuracy = (correct*1.0)/sum;
+        ctaTresult.numAutocodeDocs = sum;
+        ctaTresult.numCorrectAutocodeDocs = correct;
+        return ctaTresult;
     }
 
 
 
 
-
     public static String displayCalibrationResult(Stream<Pair<Double, Integer>> stream, int numBuckets){
         BucketInfo total = BucketInfo.aggregate(stream, numBuckets,0,1);
         double[] counts = total.getCounts();
@@ -153,4 +154,11 @@ public class Displayer {
         return result;
 
     }
+
+    public static class CTATresult{
+        public double autocodingPercent;
+        public double autocodingAccuracy;
+        public int numAutocodeDocs;
+        public int numCorrectAutocodeDocs;
+    }
 }

fix a bug in tuning CTAT; made some changes to the config file