Program: 143980
Project: 143980
Buggy source:
public static void runExperiments(int loggingLevel,List<String> domainNames,ErrorEstimationMethod[] errorEstimationMethods,Double[] alphaValues,Double[] gammaValues,List<boolean[][]> functionOutputs,List<boolean[]> trueLabels,List<boolean[][]> evaluationFunctionOutputs,CombinedResults combinedResults){
  String trueErrorRatesString="String_Node_Str";
  trueErrorRatesString+="String_Node_Str";
  double[][] realErrorRates=new double[functionOutputs.size()][];
  for (int p=0; p < functionOutputs.size(); p++) {
    realErrorRates[p]=new double[functionOutputs.get(p)[0].length];
    for (int i=0; i < trueLabels.get(p).length; i++)     for (int j=0; j < functionOutputs.get(p)[i].length; j++)     realErrorRates[p][j]+=(functionOutputs.get(p)[i][j] != trueLabels.get(p)[i]) ? 1 : 0;
    for (int j=0; j < functionOutputs.get(p)[0].length; j++)     realErrorRates[p][j]/=trueLabels.get(p).length;
    trueErrorRatesString+=domainNames.get(p);
    for (int j=0; j < functionOutputs.get(p)[0].length; j++)     trueErrorRatesString+="String_Node_Str" + realErrorRates[p][j];
    trueErrorRatesString+="String_Node_Str";
  }
  if (loggingLevel > 2)   System.out.print(trueErrorRatesString);
  boolean[][] majorityVoteLabels=new boolean[functionOutputs.size()][];
  for (int p=0; p < functionOutputs.size(); p++) {
    majorityVoteLabels[p]=new boolean[functionOutputs.get(p).length];
    for (int i=0; i < functionOutputs.get(p).length; i++) {
      double labelsSum=0;
      for (int j=0; j < functionOutputs.get(p)[i].length; j++) {
        labelsSum+=(functionOutputs.get(p)[i][j] ? 1 : 0);
      }
      majorityVoteLabels[p][i]=labelsSum / functionOutputs.get(p)[i].length >= 0.5;
    }
  }
  double majorityVoteLabelMAD=0;
  for (int p=0; p < functionOutputs.size(); p++) {
    double labelsErrorRate=0;
    for (int i=0; i < trueLabels.get(p).length; i++)     labelsErrorRate+=(majorityVoteLabels[p][i] != trueLabels.get(p)[i]) ? 1 : 0;
    labelsErrorRate/=trueLabels.get(p).length;
    majorityVoteLabelMAD+=labelsErrorRate;
  }
  majorityVoteLabelMAD/=functionOutputs.size();
  if (loggingLevel > 1)   System.out.println("String_Node_Str" + majorityVoteLabelMAD);
  double majorityVoteErrorRateMAD=0;
  for (int p=0; p < functionOutputs.size(); p++) {
    double[] estimatedErrorRates=new double[functionOutputs.get(p)[0].length];
    for (int i=0; i < majorityVoteLabels[p].length; i++)     for (int j=0; j < functionOutputs.get(p)[i].length; j++)     estimatedErrorRates[j]+=(functionOutputs.get(p)[i][j] != majorityVoteLabels[p][i]) ? 1 : 0;
    double errorRateMAD=0;
    for (int j=0; j < functionOutputs.get(p)[0].length; j++)     errorRateMAD+=Math.abs(realErrorRates[p][j] - estimatedErrorRates[j] / majorityVoteLabels[p].length);
    majorityVoteErrorRateMAD+=errorRateMAD / functionOutputs.get(p)[0].length;
  }
  majorityVoteErrorRateMAD/=functionOutputs.size();
  if (loggingLevel > 1)   System.out.println("String_Node_Str" + majorityVoteErrorRateMAD);
  combinedResults.addResult(ErrorEstimationMethod.MAJORITY_VOTE,majorityVoteErrorRateMAD,majorityVoteLabelMAD);
  Arrays.asList(errorEstimationMethods).parallelStream().forEach(method -> {
    if (method != ErrorEstimationMethod.AR_2 && method != ErrorEstimationMethod.AR_N && method != ErrorEstimationMethod.ERROR_ESTIMATION_GM) {
      ConcurrentSkipListSet<ExperimentResults> differentParameterizationResults=new ConcurrentSkipListSet<>();
      Arrays.asList(alphaValues).parallelStream().forEach(alpha -> {
        if (method == ErrorEstimationMethod.HIERARCHICAL_COUPLED_ERROR_ESTIMATION_GM) {
          Arrays.asList(gammaValues).parallelStream().forEach(gamma -> {
            ExperimentResults results=runExperiment(method,functionOutputs,trueLabels,evaluationFunctionOutputs,gamma,alpha);
            differentParameterizationResults.add(results);
            String resultsString="String_Node_Str" + method + "String_Node_Str"+ gamma+ "String_Node_Str"+ alpha+ "String_Node_Str"+ results.getErrorRateMAD()+ "String_Node_Str"+ results.getLabelMAD()+ "String_Node_Str"+ results.getLogLikelihood();
            resultsString+="String_Node_Str";
            if (loggingLevel > 2)             for (int p=0; p < functionOutputs.size(); p++) {
              resultsString+=domainNames.get(p);
              for (int j=0; j < functionOutputs.get(p)[0].length; j++)               resultsString+="String_Node_Str" + results.getErrorRates()[p][j];
              resultsString+="String_Node_Str";
            }
            if (loggingLevel > 1)             System.out.print(resultsString);
          }
);
        }
 else {
          ExperimentResults results=runExperiment(method,functionOutputs,trueLabels,evaluationFunctionOutputs,alpha,0);
          differentParameterizationResults.add(results);
          String resultsString="String_Node_Str" + method + "String_Node_Str"+ alpha+ "String_Node_Str"+ results.getErrorRateMAD()+ "String_Node_Str"+ results.getLabelMAD()+ "String_Node_Str"+ results.getLogLikelihood();
          resultsString+="String_Node_Str";
          if (loggingLevel > 2)           for (int p=0; p < functionOutputs.size(); p++) {
            resultsString+=domainNames.get(p);
            for (int j=0; j < functionOutputs.get(p)[0].length; j++)             resultsString+="String_Node_Str" + results.getErrorRates()[p][j];
            resultsString+="String_Node_Str";
          }
          if (loggingLevel > 1)           System.out.print(resultsString);
        }
      }
);
      combinedResults.addResult(method,differentParameterizationResults.last().getErrorRateMAD(),differentParameterizationResults.last().getLabelMAD());
    }
 else {
      ExperimentResults results=runExperiment(method,functionOutputs,trueLabels,evaluationFunctionOutputs,0,0);
      combinedResults.addResult(method,results.getErrorRateMAD(),results.getLabelMAD());
      String resultsString="String_Node_Str" + method + "String_Node_Str"+ results.getErrorRateMAD()+ "String_Node_Str"+ results.getLabelMAD();
      resultsString+="String_Node_Str";
      if (loggingLevel > 2)       for (int p=0; p < functionOutputs.size(); p++) {
        resultsString+=domainNames.get(p);
        for (int j=0; j < functionOutputs.get(p)[0].length; j++)         resultsString+="String_Node_Str" + results.getErrorRates()[p][j];
        resultsString+="String_Node_Str";
      }
      if (loggingLevel > 1)       System.out.print(resultsString);
    }
  }
);
  if (loggingLevel > 1)   System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public static void runExperiments(int loggingLevel,List<String> domainNames,ErrorEstimationMethod[] errorEstimationMethods,Double[] alphaValues,Double[] gammaValues,List<boolean[][]> functionOutputs,List<boolean[]> trueLabels,List<boolean[][]> evaluationFunctionOutputs,CombinedResults combinedResults){
  String trueErrorRatesString="String_Node_Str";
  trueErrorRatesString+="String_Node_Str";
  double[][] realErrorRates=new double[functionOutputs.size()][];
  for (int p=0; p < functionOutputs.size(); p++) {
    realErrorRates[p]=new double[functionOutputs.get(p)[0].length];
    for (int i=0; i < trueLabels.get(p).length; i++)     for (int j=0; j < functionOutputs.get(p)[i].length; j++)     realErrorRates[p][j]+=(functionOutputs.get(p)[i][j] != trueLabels.get(p)[i]) ? 1 : 0;
    for (int j=0; j < functionOutputs.get(p)[0].length; j++)     realErrorRates[p][j]/=trueLabels.get(p).length;
    trueErrorRatesString+=domainNames.get(p);
    for (int j=0; j < functionOutputs.get(p)[0].length; j++)     trueErrorRatesString+="String_Node_Str" + realErrorRates[p][j];
    trueErrorRatesString+="String_Node_Str";
  }
  if (loggingLevel > 2)   System.out.print(trueErrorRatesString);
  boolean[][] majorityVoteLabels=new boolean[functionOutputs.size()][];
  for (int p=0; p < functionOutputs.size(); p++) {
    majorityVoteLabels[p]=new boolean[functionOutputs.get(p).length];
    for (int i=0; i < functionOutputs.get(p).length; i++) {
      double labelsSum=0;
      for (int j=0; j < functionOutputs.get(p)[i].length; j++) {
        labelsSum+=(functionOutputs.get(p)[i][j] ? 1 : 0);
      }
      majorityVoteLabels[p][i]=labelsSum / functionOutputs.get(p)[i].length >= 0.5;
    }
  }
  double majorityVoteLabelMAD=0;
  for (int p=0; p < functionOutputs.size(); p++) {
    double labelsErrorRate=0;
    for (int i=0; i < trueLabels.get(p).length; i++)     labelsErrorRate+=(majorityVoteLabels[p][i] != trueLabels.get(p)[i]) ? 1 : 0;
    labelsErrorRate/=trueLabels.get(p).length;
    majorityVoteLabelMAD+=labelsErrorRate;
  }
  majorityVoteLabelMAD/=functionOutputs.size();
  if (loggingLevel > 1)   System.out.println("String_Node_Str" + majorityVoteLabelMAD);
  double majorityVoteErrorRateMAD=0;
  for (int p=0; p < functionOutputs.size(); p++) {
    double[] estimatedErrorRates=new double[functionOutputs.get(p)[0].length];
    for (int i=0; i < majorityVoteLabels[p].length; i++)     for (int j=0; j < functionOutputs.get(p)[i].length; j++)     estimatedErrorRates[j]+=(functionOutputs.get(p)[i][j] != majorityVoteLabels[p][i]) ? 1 : 0;
    double errorRateMAD=0;
    for (int j=0; j < functionOutputs.get(p)[0].length; j++)     errorRateMAD+=Math.abs(realErrorRates[p][j] - estimatedErrorRates[j] / majorityVoteLabels[p].length);
    majorityVoteErrorRateMAD+=errorRateMAD / functionOutputs.get(p)[0].length;
  }
  majorityVoteErrorRateMAD/=functionOutputs.size();
  if (loggingLevel > 1)   System.out.println("String_Node_Str" + majorityVoteErrorRateMAD);
  combinedResults.addResult(ErrorEstimationMethod.MAJORITY_VOTE,majorityVoteErrorRateMAD,majorityVoteLabelMAD);
  Arrays.asList(errorEstimationMethods).parallelStream().forEach(method -> {
    if (method != ErrorEstimationMethod.AR_2 && method != ErrorEstimationMethod.AR_N && method != ErrorEstimationMethod.ERROR_ESTIMATION_GM) {
      ConcurrentSkipListSet<ExperimentResults> differentParameterizationResults=new ConcurrentSkipListSet<>();
      Arrays.asList(alphaValues).parallelStream().forEach(alpha -> {
        if (method == ErrorEstimationMethod.HIERARCHICAL_COUPLED_ERROR_ESTIMATION_GM) {
          Arrays.asList(gammaValues).parallelStream().forEach(gamma -> {
            ExperimentResults results=runExperiment(method,functionOutputs,trueLabels,evaluationFunctionOutputs,alpha,gamma);
            differentParameterizationResults.add(results);
            String resultsString="String_Node_Str" + method + "String_Node_Str"+ gamma+ "String_Node_Str"+ alpha+ "String_Node_Str"+ results.getErrorRateMAD()+ "String_Node_Str"+ results.getLabelMAD()+ "String_Node_Str"+ results.getLogLikelihood();
            resultsString+="String_Node_Str";
            if (loggingLevel > 2)             for (int p=0; p < functionOutputs.size(); p++) {
              resultsString+=domainNames.get(p);
              for (int j=0; j < functionOutputs.get(p)[0].length; j++)               resultsString+="String_Node_Str" + results.getErrorRates()[p][j];
              resultsString+="String_Node_Str";
            }
            if (loggingLevel > 1)             System.out.print(resultsString);
          }
);
        }
 else {
          ExperimentResults results=runExperiment(method,functionOutputs,trueLabels,evaluationFunctionOutputs,alpha,0);
          differentParameterizationResults.add(results);
          String resultsString="String_Node_Str" + method + "String_Node_Str"+ alpha+ "String_Node_Str"+ results.getErrorRateMAD()+ "String_Node_Str"+ results.getLabelMAD()+ "String_Node_Str"+ results.getLogLikelihood();
          resultsString+="String_Node_Str";
          if (loggingLevel > 2)           for (int p=0; p < functionOutputs.size(); p++) {
            resultsString+=domainNames.get(p);
            for (int j=0; j < functionOutputs.get(p)[0].length; j++)             resultsString+="String_Node_Str" + results.getErrorRates()[p][j];
            resultsString+="String_Node_Str";
          }
          if (loggingLevel > 1)           System.out.print(resultsString);
        }
      }
);
      combinedResults.addResult(method,differentParameterizationResults.last().getErrorRateMAD(),differentParameterizationResults.last().getLabelMAD());
    }
 else {
      ExperimentResults results=runExperiment(method,functionOutputs,trueLabels,evaluationFunctionOutputs,0,0);
      combinedResults.addResult(method,results.getErrorRateMAD(),results.getLabelMAD());
      String resultsString="String_Node_Str" + method + "String_Node_Str"+ results.getErrorRateMAD()+ "String_Node_Str"+ results.getLabelMAD();
      resultsString+="String_Node_Str";
      if (loggingLevel > 2)       for (int p=0; p < functionOutputs.size(); p++) {
        resultsString+=domainNames.get(p);
        for (int j=0; j < functionOutputs.get(p)[0].length; j++)         resultsString+="String_Node_Str" + results.getErrorRates()[p][j];
        resultsString+="String_Node_Str";
      }
      if (loggingLevel > 1)       System.out.print(resultsString);
    }
  }
);
  if (loggingLevel > 1)   System.out.println("String_Node_Str");
}