Program: 143970
Project: 143970
Buggy source:
private void computeIntegratedDataAndErrorRates(){
  if (!needsComputeIntegratedDataAndErrorRates)   return;
  List<Data.PredictedInstance> integratedDataInstances=new ArrayList<>();
  List<ErrorRates.Instance> errorRatesInstances=new ArrayList<>();
  Map<Label,Map<Integer,Boolean>> integratedPredictions=new HashMap<>();
  for (  Label label : labels) {
    integratedPredictions.put(label,new HashMap<>());
    Map<Integer,int[]> predictions=new HashMap<>();
    data.stream().filter(i -> i.label().equals(label)).forEach(instance -> {
      if (!predictions.containsKey(instance.id()))       predictions.put(instance.id(),new int[2]);
      if (instance.value() >= 0.5)       predictions.get(instance.id())[0]++;
 else       predictions.get(instance.id())[1]++;
    }
);
    for (    Map.Entry<Integer,int[]> prediction : predictions.entrySet())     if (prediction.getValue()[0] >= prediction.getValue()[1]) {
      integratedDataInstances.add(new Data.PredictedInstance(prediction.getKey(),label,-1,1.0));
      integratedPredictions.get(label).put(prediction.getKey(),true);
    }
 else {
      integratedDataInstances.add(new Data.PredictedInstance(prediction.getKey(),label,-1,0.0));
      integratedPredictions.get(label).put(prediction.getKey(),false);
    }
    data.stream().filter(i -> i.label().equals(label)).map(Data.PredictedInstance::functionId).distinct().forEach(classifierID -> {
      int[] numberOfErrorSamples=new int[]{0};
      int[] numberOfSamples=new int[]{0};
      data.stream().filter(i -> i.label().equals(label) && i.functionId() == classifierID).forEach(instance -> {
        if ((instance.value() >= 0.5 && !integratedPredictions.get(label).get(instance.id())) || (instance.value() < 0.5 && integratedPredictions.get(label).get(instance.id())))         numberOfErrorSamples[0]++;
        numberOfSamples[0]++;
      }
);
      errorRatesInstances.add(new ErrorRates.Instance(label,classifierID,numberOfErrorSamples[0] / (double)numberOfSamples[0]));
    }
);
  }
  integratedData=new Data<>(integratedDataInstances);
  errorRates=new ErrorRates(errorRatesInstances);
  needsComputeIntegratedDataAndErrorRates=false;
}

Fixed version (ground truth):
private void computeIntegratedDataAndErrorRates(){
  if (!needsComputeIntegratedDataAndErrorRates)   return;
  List<Data.PredictedInstance> integratedDataInstances=new ArrayList<>();
  List<ErrorRates.Instance> errorRatesInstances=new ArrayList<>();
  Map<Label,Map<Integer,Boolean>> integratedPredictions=new HashMap<>();
  for (  Label label : labels) {
    integratedPredictions.put(label,new HashMap<>());
    Map<Integer,int[]> predictions=new HashMap<>();
    data.stream().filter(i -> i.label().equals(label)).forEach(instance -> {
      if (!predictions.containsKey(instance.id()))       predictions.put(instance.id(),new int[2]);
      if (instance.value() >= 0.5)       predictions.get(instance.id())[0]++;
 else       predictions.get(instance.id())[1]++;
    }
);
    for (    Map.Entry<Integer,int[]> prediction : predictions.entrySet())     if (prediction.getValue()[0] >= prediction.getValue()[1]) {
      integratedDataInstances.add(new Data.PredictedInstance(prediction.getKey(),label,-1,1.0));
      integratedPredictions.get(label).put(prediction.getKey(),true);
    }
 else {
      integratedDataInstances.add(new Data.PredictedInstance(prediction.getKey(),label,-1,0.0));
      integratedPredictions.get(label).put(prediction.getKey(),false);
    }
    data.stream().filter(i -> i.label().equals(label)).map(Data.PredictedInstance::functionId).distinct().forEach(functionId -> {
      int[] numberOfErrorSamples=new int[]{0};
      int[] numberOfSamples=new int[]{0};
      data.stream().filter(i -> i.label().equals(label) && i.functionId() == functionId).forEach(instance -> {
        if ((instance.value() >= 0.5 && !integratedPredictions.get(label).get(instance.id())) || (instance.value() < 0.5 && integratedPredictions.get(label).get(instance.id())))         numberOfErrorSamples[0]++;
        numberOfSamples[0]++;
      }
);
      errorRatesInstances.add(new ErrorRates.Instance(label,functionId,numberOfErrorSamples[0] / (double)numberOfSamples[0]));
    }
);
  }
  integratedData=new Data<>(integratedDataInstances);
  errorRates=new ErrorRates(errorRatesInstances);
  needsComputeIntegratedDataAndErrorRates=false;
}