Program: 144001
Project: 144001
Buggy source:
@Override public void addResult(String name,List<PredictedDataInstance<T,S>> predictions,Function<PredictedDataInstance<T,S>,Boolean> groundTruth){
  int totalNumberOfPositiveLabels=0;
  for (  PredictedDataInstance<T,S> prediction : predictions)   if (groundTruth.apply(prediction))   totalNumberOfPositiveLabels++;
  Collections.sort(predictions,Comparator.comparing(PredictedDataInstance::probability));
  List<CurvePoint> points=new ArrayList<>();
  double areaUnderCurve=0;
  double idealDiscountedCumulativeGain=0;
  for (int predictionIndex=0; predictionIndex < predictions.size(); predictionIndex++) {
    double relevantPrediction=groundTruth.apply(predictions.get(predictionIndex)) ? 1 : 0;
    if (!useAlternativeFormulation) {
      if (points.size() == 0) {
        if (predictionIndex < totalNumberOfPositiveLabels)         idealDiscountedCumulativeGain++;
        points.add(new CurvePoint(predictionIndex + 1,relevantPrediction / idealDiscountedCumulativeGain));
        continue;
      }
      double discountedCumulativeGain=points.get(points.size() - 1).getVerticalAxisValue() * idealDiscountedCumulativeGain + relevantPrediction * Math.log(2) / Math.log(predictionIndex + 1);
      if (predictionIndex < totalNumberOfPositiveLabels)       idealDiscountedCumulativeGain+=Math.log(2) / Math.log(predictionIndex + 1);
      points.add(new CurvePoint(predictionIndex + 1,discountedCumulativeGain / idealDiscountedCumulativeGain));
    }
 else {
      if (points.size() == 0) {
        if (predictionIndex < totalNumberOfPositiveLabels)         idealDiscountedCumulativeGain+=Math.log(2) / Math.log(predictionIndex + 2);
        double discountedCumulativeGain=(Math.pow(2,relevantPrediction) - 1) * Math.log(2) / Math.log(predictionIndex + 2);
        points.add(new CurvePoint(predictionIndex + 1,discountedCumulativeGain / idealDiscountedCumulativeGain));
        continue;
      }
      double discountedCumulativeGain=points.get(points.size() - 1).getVerticalAxisValue() * idealDiscountedCumulativeGain + (Math.pow(2,relevantPrediction) - 1) * Math.log(2) / Math.log(predictionIndex + 2);
      if (predictionIndex < totalNumberOfPositiveLabels)       idealDiscountedCumulativeGain+=Math.log(2) / Math.log(predictionIndex + 2);
      points.add(new CurvePoint(predictionIndex + 1,discountedCumulativeGain / idealDiscountedCumulativeGain));
    }
    int k=points.size() - 1;
    areaUnderCurve+=0.5 * (points.get(k).getHorizontalAxisValue() - points.get(k - 1).getHorizontalAxisValue()) * (points.get(k).getVerticalAxisValue() + points.get(k - 1).getVerticalAxisValue());
  }
  areaUnderCurve+=0.5 * (1 - points.get(points.size() - 2).getHorizontalAxisValue()) * (1 + points.get(points.size() - 2).getVerticalAxisValue());
  curves.add(new Curve(name,points));
  areaUnderCurves.add(areaUnderCurve);
}

Fixed version (ground truth):
@Override public void addResult(String name,List<PredictedDataInstance<T,S>> predictions,Function<PredictedDataInstance<T,S>,Boolean> groundTruth){
  int totalNumberOfPositiveLabels=0;
  for (  PredictedDataInstance<T,S> prediction : predictions)   if (groundTruth.apply(prediction))   totalNumberOfPositiveLabels++;
  Collections.sort(predictions,Comparator.comparing(PredictedDataInstance::probability));
  List<CurvePoint> points=new ArrayList<>();
  double areaUnderCurve=0;
  double idealDiscountedCumulativeGain=0;
  for (int predictionIndex=0; predictionIndex < predictions.size(); predictionIndex++) {
    double relevantPrediction=groundTruth.apply(predictions.get(predictionIndex)) ? 1 : 0;
    if (!useAlternativeFormulation) {
      if (points.size() == 0) {
        if (predictionIndex < totalNumberOfPositiveLabels)         idealDiscountedCumulativeGain++;
        points.add(new CurvePoint(predictionIndex + 1,relevantPrediction / idealDiscountedCumulativeGain));
        continue;
      }
      double discountedCumulativeGain=points.get(points.size() - 1).getVerticalAxisValue() * idealDiscountedCumulativeGain + relevantPrediction * Math.log(2) / Math.log(predictionIndex + 1);
      if (predictionIndex < totalNumberOfPositiveLabels)       idealDiscountedCumulativeGain+=Math.log(2) / Math.log(predictionIndex + 1);
      points.add(new CurvePoint(predictionIndex + 1,discountedCumulativeGain / idealDiscountedCumulativeGain));
    }
 else {
      if (points.size() == 0) {
        if (predictionIndex < totalNumberOfPositiveLabels)         idealDiscountedCumulativeGain+=Math.log(2) / Math.log(predictionIndex + 2);
        double discountedCumulativeGain=(Math.pow(2,relevantPrediction) - 1) * Math.log(2) / Math.log(predictionIndex + 2);
        points.add(new CurvePoint(predictionIndex + 1,discountedCumulativeGain / idealDiscountedCumulativeGain));
        continue;
      }
      double discountedCumulativeGain=points.get(points.size() - 1).getVerticalAxisValue() * idealDiscountedCumulativeGain + (Math.pow(2,relevantPrediction) - 1) * Math.log(2) / Math.log(predictionIndex + 2);
      if (predictionIndex < totalNumberOfPositiveLabels)       idealDiscountedCumulativeGain+=Math.log(2) / Math.log(predictionIndex + 2);
      points.add(new CurvePoint(predictionIndex + 1,discountedCumulativeGain / idealDiscountedCumulativeGain));
    }
    int k=points.size() - 1;
    areaUnderCurve+=0.5 * (points.get(k).getHorizontalAxisValue() - points.get(k - 1).getHorizontalAxisValue()) * (points.get(k).getVerticalAxisValue() + points.get(k - 1).getVerticalAxisValue());
  }
  curves.add(new Curve(name,points));
  areaUnderCurves.add(areaUnderCurve);
}