Program: 24873
Project: 24873
Buggy source:
@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> docRecordsForEventB=ImmutableList.builder();
        for (        final DocLevelLinkingScoring linkingScoring : collection) {
          if (linkingScoring.docRecordsPerEventType().containsKey(eventType)) {
            docRecordsForEventB.add(linkingScoring.docRecordsPerEventType().get(eventType));
          }
        }
        aggregateRecordsPerEventTypeB.put(eventType,aggregateScores(docRecordsForEventB.build()));
      }
    }
    public void finish() throws IOException {
      final ImmutableList<AggregateLinkingScoreRecord> aggregateRecords=aggregateRecordsB.build();
      writer.writeBootstrapData("String_Node_Str",mapScoresForWriter(aggregateRecords),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);
        writer.writeBootstrapData("String_Node_Str",mapScoresForWriter(aggregateRecordsForEvent),new File(new File(outputDir,"String_Node_Str"),eventType.asString()));
      }
    }
    private ImmutableMap<String,ImmutableListMultimap<String,Double>> mapScoresForWriter(    ImmutableList<AggregateLinkingScoreRecord> aggregateRecords){
      return ImmutableMap.of(F1,Multimaps.index(transform(aggregateRecords,AggregateLinkingScoreRecordFunctions.f1()),constant("String_Node_Str")),PRECISION,Multimaps.index(transform(aggregateRecords,AggregateLinkingScoreRecordFunctions.precision()),constant("String_Node_Str")),RECALL,Multimaps.index(transform(aggregateRecords,AggregateLinkingScoreRecordFunctions.recall()),constant("String_Node_Str")));
    }
    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();
    }
  }
);
}

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> docRecordsForEventB=ImmutableList.builder();
        for (        final DocLevelLinkingScoring linkingScoring : collection) {
          if (linkingScoring.docRecordsPerEventType().containsKey(eventType)) {
            docRecordsForEventB.add(linkingScoring.docRecordsPerEventType().get(eventType));
          }
        }
        aggregateRecordsPerEventTypeB.put(eventType,aggregateScores(docRecordsForEventB.build()));
      }
    }
    @Override public void finish() throws IOException {
      final ImmutableList<AggregateLinkingScoreRecord> aggregateRecords=aggregateRecordsB.build();
      writer.writeBootstrapData("String_Node_Str",mapScoresForWriter(aggregateRecords),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);
        writer.writeBootstrapData("String_Node_Str",mapScoresForWriter(aggregateRecordsForEvent),new File(new File(outputDir,"String_Node_Str"),eventType.asString()));
      }
    }
    private ImmutableMap<String,ImmutableListMultimap<String,Double>> mapScoresForWriter(    ImmutableList<AggregateLinkingScoreRecord> aggregateRecords){
      return ImmutableMap.of(F1,Multimaps.index(transform(aggregateRecords,AggregateLinkingScoreRecordFunctions.f1()),constant("String_Node_Str")),PRECISION,Multimaps.index(transform(aggregateRecords,AggregateLinkingScoreRecordFunctions.precision()),constant("String_Node_Str")),RECALL,Multimaps.index(transform(aggregateRecords,AggregateLinkingScoreRecordFunctions.recall()),constant("String_Node_Str")));
    }
    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();
    }
  }
);
}