Program: 24890
Project: 24890
Buggy source:
@Override public Collection<BootstrapInspector.SummaryAggregator<DocLevelLinkingScoring>> createSummaryAggregators(){
  return ImmutableList.<BootstrapInspector.SummaryAggregator<DocLevelLinkingScoring>>of(new BootstrapInspector.SummaryAggregator<DocLevelLinkingScoring>(){
    private final AggregateLinkingScoreRecord.Builder aggregateRecordB=new AggregateLinkingScoreRecord.Builder();
    private final ImmutableMap.Builder<Symbol,AggregateLinkingScoreRecord> aggregateRecordsPerEventTypeB=ImmutableMap.builder();
    private static final String F1="String_Node_Str";
    private static final String PRECISION="String_Node_Str";
    private static final String RECALL="String_Node_Str";
    private final BootstrapWriter writer=new BootstrapWriter.Builder().measures(ImmutableList.of(F1,PRECISION,RECALL)).percentilesToPrint(ImmutableList.of(0.005,0.025,0.05,0.25,0.5,0.75,0.95,0.975,0.995)).percentileComputer(PercentileComputer.nistPercentileComputer()).build();
    @Override public void observeSample(    final Collection<DocLevelLinkingScoring> collection){
{
        final ImmutableList.Builder<LinkingScoreDocRecord> docRecordsB=ImmutableList.builder();
        for (        final DocLevelLinkingScoring linkingScoring : collection) {
          docRecordsB.add(linkingScoring.linkingScoreDocRecord());
        }
        aggregateRecordB.from(aggregateScores(docRecordsB.build()));
      }
{
        final ImmutableSet.Builder<Symbol> eventTypesB=ImmutableSet.builder();
        for (        final DocLevelLinkingScoring linkingScoring : collection) {
          eventTypesB.addAll(linkingScoring.docRecordsPerEventType().keySet());
        }
        final ImmutableSet<Symbol> eventTypes=eventTypesB.build();
        for (        final Symbol eventType : eventTypes) {
          final ImmutableList.Builder<LinkingScoreDocRecord> docRecordsB=ImmutableList.builder();
          for (          final DocLevelLinkingScoring linkingScoring : collection) {
            if (linkingScoring.docRecordsPerEventType().containsKey(eventType)) {
              docRecordsB.add(linkingScoring.docRecordsPerEventType().get(eventType));
            }
          }
          aggregateRecordsPerEventTypeB.put(eventType,aggregateScores(docRecordsB.build()));
        }
      }
    }
    public void finish() throws IOException {
      final AggregateLinkingScoreRecord aggregateRecord=aggregateRecordB.build();
      writer.writeBootstrapData("String_Node_Str",ImmutableMap.of(F1,aggregateRecord.f1s(),PRECISION,aggregateRecord.precisions(),RECALL,aggregateRecord.recalls()),new File(outputDir,"String_Node_Str"));
      final ImmutableMap<Symbol,AggregateLinkingScoreRecord> aggregateRecordsPerEvent=aggregateRecordsPerEventTypeB.build();
      for (      Symbol eventType : aggregateRecordsPerEvent.keySet()) {
        AggregateLinkingScoreRecord recordForEventType=aggregateRecordsPerEvent.get(eventType);
        writer.writeBootstrapData("String_Node_Str" + eventType.asString(),ImmutableMap.of(F1,recordForEventType.f1s(),PRECISION,recordForEventType.precisions(),RECALL,recordForEventType.recalls()),new File(outputDir,"String_Node_Str" + eventType.asString()));
      }
    }
    private AggregateLinkingScoreRecord aggregateScores(    ImmutableList<LinkingScoreDocRecord> docRecords){
      double precision=0.0;
      double recall=0.0;
      double f1=0.0;
      double linkNormalizerSum=0.0;
      final ImmutableListMultimap.Builder<String,Double> f1sB=ImmutableListMultimap.builder();
      final ImmutableListMultimap.Builder<String,Double> precisionsB=ImmutableListMultimap.builder();
      final ImmutableListMultimap.Builder<String,Double> recallsB=ImmutableListMultimap.builder();
      for (      final LinkingScoreDocRecord docRecord : docRecords) {
        precision+=docRecord.fMeasureInfo().precision() * docRecord.predictedCounts();
        recall+=docRecord.fMeasureInfo().recall() * docRecord.actualCounts();
        f1+=docRecord.fMeasureInfo().f1() * docRecord.actualCounts();
        linkNormalizerSum+=docRecord.linkingArgCounts();
      }
      f1sB.put("String_Node_Str",(linkNormalizerSum > 0.0) ? f1 / linkNormalizerSum : 0.0);
      precisionsB.put("String_Node_Str",(linkNormalizerSum > 0.0) ? precision / linkNormalizerSum : 0.0);
      recallsB.put("String_Node_Str",(linkNormalizerSum > 0.0) ? recall / linkNormalizerSum : 0.0);
      return new AggregateLinkingScoreRecord.Builder().f1s(f1sB.build()).precisions(precisionsB.build()).recalls(recallsB.build()).build();
    }
  }
);
}

Fixed version (ground truth):
@Override public Collection<BootstrapInspector.SummaryAggregator<DocLevelLinkingScoring>> createSummaryAggregators(){
  return ImmutableList.<BootstrapInspector.SummaryAggregator<DocLevelLinkingScoring>>of(new BootstrapInspector.SummaryAggregator<DocLevelLinkingScoring>(){
    private final ImmutableList.Builder<AggregateLinkingScoreRecord> aggregateRecordsB=ImmutableList.builder();
    private final ImmutableListMultimap.Builder<Symbol,AggregateLinkingScoreRecord> aggregateRecordsPerEventTypeB=ImmutableListMultimap.builder();
    private static final String F1="String_Node_Str";
    private static final String PRECISION="String_Node_Str";
    private static final String RECALL="String_Node_Str";
    private final BootstrapWriter writer=new BootstrapWriter.Builder().measures(ImmutableList.of(F1,PRECISION,RECALL)).percentilesToPrint(ImmutableList.of(0.005,0.025,0.05,0.25,0.5,0.75,0.95,0.975,0.995)).percentileComputer(PercentileComputer.nistPercentileComputer()).build();
    @Override public void observeSample(    final Collection<DocLevelLinkingScoring> collection){
{
        final ImmutableList.Builder<LinkingScoreDocRecord> docRecordsB=ImmutableList.builder();
        for (        final DocLevelLinkingScoring linkingScoring : collection) {
          docRecordsB.add(linkingScoring.linkingScoreDocRecord());
        }
        aggregateRecordsB.add(aggregateScores(docRecordsB.build()));
      }
{
        final ImmutableSet.Builder<Symbol> eventTypesB=ImmutableSet.builder();
        for (        final DocLevelLinkingScoring linkingScoring : collection) {
          eventTypesB.addAll(linkingScoring.docRecordsPerEventType().keySet());
        }
        final ImmutableSet<Symbol> eventTypes=eventTypesB.build();
        for (        final Symbol eventType : eventTypes) {
          final ImmutableList.Builder<LinkingScoreDocRecord> docRecordsB=ImmutableList.builder();
          for (          final DocLevelLinkingScoring linkingScoring : collection) {
            if (linkingScoring.docRecordsPerEventType().containsKey(eventType)) {
              docRecordsB.add(linkingScoring.docRecordsPerEventType().get(eventType));
            }
          }
          aggregateRecordsPerEventTypeB.put(eventType,aggregateScores(docRecordsB.build()));
        }
      }
    }
    public void finish() throws IOException {
{
        final ImmutableList<AggregateLinkingScoreRecord> aggregateRecords=aggregateRecordsB.build();
        final ImmutableList<Double> f1s=ImmutableList.copyOf(transform(aggregateRecords,AggregateLinkingScoreRecordFunctions.f1()));
        final ImmutableList<Double> precisions=ImmutableList.copyOf(transform(aggregateRecords,AggregateLinkingScoreRecordFunctions.precision()));
        final ImmutableList<Double> recalls=ImmutableList.copyOf(transform(aggregateRecords,AggregateLinkingScoreRecordFunctions.recall()));
        writer.writeBootstrapData("String_Node_Str",ImmutableMap.of(F1,new ImmutableListMultimap.Builder<String,Double>().putAll("String_Node_Str",f1s).build(),PRECISION,new ImmutableListMultimap.Builder<String,Double>().putAll("String_Node_Str",precisions).build(),RECALL,new ImmutableListMultimap.Builder<String,Double>().putAll("String_Node_Str",recalls).build()),new File(outputDir,"String_Node_Str"));
      }
{
        final ImmutableListMultimap<Symbol,AggregateLinkingScoreRecord> aggregateRecordsPerEvent=aggregateRecordsPerEventTypeB.build();
        for (        Symbol eventType : aggregateRecordsPerEvent.keySet()) {
          final ImmutableList<AggregateLinkingScoreRecord> aggregateRecordsForEvent=aggregateRecordsPerEvent.get(eventType);
          final ImmutableList<Double> f1s=ImmutableList.copyOf(transform(aggregateRecordsForEvent,AggregateLinkingScoreRecordFunctions.f1()));
          final ImmutableList<Double> precisions=ImmutableList.copyOf(transform(aggregateRecordsForEvent,AggregateLinkingScoreRecordFunctions.precision()));
          final ImmutableList<Double> recalls=ImmutableList.copyOf(transform(aggregateRecordsForEvent,AggregateLinkingScoreRecordFunctions.recall()));
          writer.writeBootstrapData("String_Node_Str",ImmutableMap.of(F1,new ImmutableListMultimap.Builder<String,Double>().putAll("String_Node_Str",f1s).build(),PRECISION,new ImmutableListMultimap.Builder<String,Double>().putAll("String_Node_Str",precisions).build(),RECALL,new ImmutableListMultimap.Builder<String,Double>().putAll("String_Node_Str",recalls).build()),new File(new File(outputDir,"String_Node_Str"),eventType.asString()));
        }
      }
    }
    private AggregateLinkingScoreRecord aggregateScores(    ImmutableList<LinkingScoreDocRecord> docRecords){
      double precision=0.0;
      double recall=0.0;
      double f1=0.0;
      double linkNormalizerSum=0.0;
      for (      final LinkingScoreDocRecord docRecord : docRecords) {
        precision+=docRecord.fMeasureInfo().precision() * docRecord.predictedCounts();
        recall+=docRecord.fMeasureInfo().recall() * docRecord.actualCounts();
        f1+=docRecord.fMeasureInfo().f1() * docRecord.actualCounts();
        linkNormalizerSum+=docRecord.linkingArgCounts();
      }
      f1=(linkNormalizerSum > 0.0) ? f1 / linkNormalizerSum : 0.0;
      precision=(linkNormalizerSum > 0.0) ? precision / linkNormalizerSum : 0.0;
      recall=(linkNormalizerSum > 0.0) ? recall / linkNormalizerSum : 0.0;
      return new AggregateLinkingScoreRecord.Builder().f1(f1).precision(precision).recall(recall).build();
    }
  }
);
}