Program: 9733
Project: 9733
Buggy source:
public NestedCrossValidation(File confFile,int outerFolds,int innerFolds,String parameter,int startValue,int endValue,boolean verbose) throws FileNotFoundException, ComponentInitException, ParseException {
  DecimalFormat df=new DecimalFormat();
  ComponentManager cm=ComponentManager.getInstance();
  Start start=new Start(confFile);
  LearningProblem lp=start.getLearningProblem();
  if (!(lp instanceof PosNegLP)) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  LinkedList<Individual> posExamples=new LinkedList<Individual>(((PosNegLP)lp).getPositiveExamples());
  Collections.shuffle(posExamples,new Random(1));
  LinkedList<Individual> negExamples=new LinkedList<Individual>(((PosNegLP)lp).getNegativeExamples());
  Collections.shuffle(negExamples,new Random(2));
  ReasonerComponent rc=start.getReasonerComponent();
  String baseURI=rc.getBaseURI();
  List<TrainTestList> posLists=getFolds(posExamples,outerFolds);
  List<TrainTestList> negLists=getFolds(negExamples,outerFolds);
  Stat accOverall=new Stat();
  Stat fOverall=new Stat();
  Stat recallOverall=new Stat();
  Stat precisionOverall=new Stat();
  for (int currOuterFold=0; currOuterFold < outerFolds; currOuterFold++) {
    System.out.println("String_Node_Str" + currOuterFold);
    TrainTestList posList=posLists.get(currOuterFold);
    TrainTestList negList=negLists.get(currOuterFold);
    Map<Integer,Stat> paraStats=new HashMap<Integer,Stat>();
    for (int currParaValue=startValue; currParaValue <= endValue; currParaValue++) {
      System.out.println("String_Node_Str" + currParaValue + "String_Node_Str");
      List<Individual> trainPosList=posList.getTrainList();
      List<TrainTestList> innerPosLists=getFolds(trainPosList,innerFolds);
      List<Individual> trainNegList=negList.getTrainList();
      List<TrainTestList> innerNegLists=getFolds(trainNegList,innerFolds);
      Stat paraCriterionStat=new Stat();
      for (int currInnerFold=0; currInnerFold < innerFolds; currInnerFold++) {
        System.out.println("String_Node_Str" + currInnerFold + "String_Node_Str");
        Set<Individual> posEx=new TreeSet<Individual>(innerPosLists.get(currInnerFold).getTrainList());
        Set<Individual> negEx=new TreeSet<Individual>(innerNegLists.get(currInnerFold).getTrainList());
        start=new Start(confFile);
        LearningProblem lpIn=start.getLearningProblem();
        cm.applyConfigEntry(lpIn,"String_Node_Str",Datastructures.individualSetToStringSet(posEx));
        cm.applyConfigEntry(lpIn,"String_Node_Str",Datastructures.individualSetToStringSet(negEx));
        LearningAlgorithm laIn=start.getLearningAlgorithm();
        cm.applyConfigEntry(laIn,parameter,(double)currParaValue);
        lpIn.init();
        laIn.init();
        laIn.start();
        Description concept=laIn.getCurrentlyBestDescription();
        TreeSet<Individual> posTest=new TreeSet<Individual>(innerPosLists.get(currInnerFold).getTestList());
        TreeSet<Individual> negTest=new TreeSet<Individual>(innerNegLists.get(currInnerFold).getTestList());
        ReasonerComponent rs=start.getReasonerComponent();
        Set<Individual> posCorrect=rs.hasType(concept,posTest);
        Set<Individual> posError=Helper.difference(posTest,posCorrect);
        Set<Individual> negError=rs.hasType(concept,negTest);
        Set<Individual> negCorrect=Helper.difference(negTest,negError);
        double accuracy=100 * ((double)(posCorrect.size() + negCorrect.size()) / (posTest.size() + negTest.size()));
        double precision=100 * (double)posCorrect.size() / (posCorrect.size() + negError.size());
        double recall=100 * (double)posCorrect.size() / (posCorrect.size() + posError.size());
        double fmeasure=2 * (precision * recall) / (precision + recall);
        paraCriterionStat.addNumber(accuracy);
        System.out.println("String_Node_Str" + concept.toManchesterSyntaxString(baseURI,null));
        System.out.println("String_Node_Str" + df.format(accuracy) + "String_Node_Str");
        System.out.println("String_Node_Str" + df.format(precision) + "String_Node_Str");
        System.out.println("String_Node_Str" + df.format(recall) + "String_Node_Str");
        System.out.println("String_Node_Str" + df.format(fmeasure) + "String_Node_Str");
        if (verbose) {
          System.out.println("String_Node_Str" + formatIndividualSet(posError,baseURI));
          System.out.println("String_Node_Str" + formatIndividualSet(negError,baseURI));
        }
        rs.releaseKB();
        cm.freeAllComponents();
      }
      paraStats.put(currParaValue,paraCriterionStat);
    }
    System.out.println("String_Node_Str");
    int bestPara=startValue;
    double bestValue=Double.NEGATIVE_INFINITY;
    for (    Entry<Integer,Stat> entry : paraStats.entrySet()) {
      int para=entry.getKey();
      Stat stat=entry.getValue();
      System.out.println("String_Node_Str" + para + "String_Node_Str"+ stat.prettyPrint("String_Node_Str"));
      if (stat.getMean() > bestValue) {
        bestPara=para;
        bestValue=stat.getMean();
      }
    }
    System.out.println("String_Node_Str" + bestPara + "String_Node_Str"+ df.format(bestValue)+ "String_Node_Str");
    System.out.println("String_Node_Str");
    start=new Start(confFile);
    LearningProblem lpOut=start.getLearningProblem();
    cm.applyConfigEntry(lpOut,"String_Node_Str",Datastructures.individualListToStringSet(posLists.get(currOuterFold).getTrainList()));
    cm.applyConfigEntry(lpOut,"String_Node_Str",Datastructures.individualListToStringSet(negLists.get(currOuterFold).getTrainList()));
    LearningAlgorithm laOut=start.getLearningAlgorithm();
    cm.applyConfigEntry(laOut,parameter,(double)bestPara);
    lpOut.init();
    laOut.init();
    laOut.start();
    Description concept=laOut.getCurrentlyBestDescription();
    TreeSet<Individual> posTest=new TreeSet<Individual>(posLists.get(currOuterFold).getTestList());
    TreeSet<Individual> negTest=new TreeSet<Individual>(negLists.get(currOuterFold).getTestList());
    ReasonerComponent rs=start.getReasonerComponent();
    Set<Individual> posCorrect=rs.hasType(concept,posTest);
    Set<Individual> posError=Helper.difference(posTest,posCorrect);
    Set<Individual> negError=rs.hasType(concept,negTest);
    Set<Individual> negCorrect=Helper.difference(negTest,negError);
    double accuracy=100 * ((double)(posCorrect.size() + negCorrect.size()) / (posTest.size() + negTest.size()));
    double precision=100 * (double)posCorrect.size() / (posCorrect.size() + negError.size());
    double recall=100 * (double)posCorrect.size() / (posCorrect.size() + posError.size());
    double fmeasure=2 * (precision * recall) / (precision + recall);
    System.out.println("String_Node_Str" + concept.toManchesterSyntaxString(baseURI,null));
    System.out.println("String_Node_Str" + df.format(accuracy) + "String_Node_Str");
    System.out.println("String_Node_Str" + df.format(precision) + "String_Node_Str");
    System.out.println("String_Node_Str" + df.format(recall) + "String_Node_Str");
    System.out.println("String_Node_Str" + df.format(fmeasure) + "String_Node_Str");
    if (verbose) {
      System.out.println("String_Node_Str" + formatIndividualSet(posError,baseURI));
      System.out.println("String_Node_Str" + formatIndividualSet(negError,baseURI));
    }
    accOverall.addNumber(accuracy);
    fOverall.addNumber(fmeasure);
    recallOverall.addNumber(recall);
    precisionOverall.addNumber(precision);
    rs.releaseKB();
    cm.freeAllComponents();
  }
  System.out.println();
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str" + accOverall.prettyPrint("String_Node_Str"));
  System.out.println("String_Node_Str" + fOverall.prettyPrint("String_Node_Str"));
  System.out.println("String_Node_Str" + precisionOverall.prettyPrint("String_Node_Str"));
  System.out.println("String_Node_Str" + recallOverall.prettyPrint("String_Node_Str"));
}

Fixed version (ground truth):
public NestedCrossValidation(File confFile,int outerFolds,int innerFolds,String parameter,int startValue,int endValue,boolean verbose) throws FileNotFoundException, ComponentInitException, ParseException, org.dllearner.confparser.ParseException {
  DecimalFormat df=new DecimalFormat();
  ComponentManager cm=ComponentManager.getInstance();
  Start start=new Start(confFile);
  LearningProblem lp=start.getLearningProblem();
  if (!(lp instanceof PosNegLP)) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  LinkedList<Individual> posExamples=new LinkedList<Individual>(((PosNegLP)lp).getPositiveExamples());
  Collections.shuffle(posExamples,new Random(1));
  LinkedList<Individual> negExamples=new LinkedList<Individual>(((PosNegLP)lp).getNegativeExamples());
  Collections.shuffle(negExamples,new Random(2));
  ReasonerComponent rc=start.getReasonerComponent();
  String baseURI=rc.getBaseURI();
  List<TrainTestList> posLists=getFolds(posExamples,outerFolds);
  List<TrainTestList> negLists=getFolds(negExamples,outerFolds);
  Stat accOverall=new Stat();
  Stat fOverall=new Stat();
  Stat recallOverall=new Stat();
  Stat precisionOverall=new Stat();
  for (int currOuterFold=0; currOuterFold < outerFolds; currOuterFold++) {
    System.out.println("String_Node_Str" + currOuterFold);
    TrainTestList posList=posLists.get(currOuterFold);
    TrainTestList negList=negLists.get(currOuterFold);
    Map<Integer,Stat> paraStats=new HashMap<Integer,Stat>();
    for (int currParaValue=startValue; currParaValue <= endValue; currParaValue++) {
      System.out.println("String_Node_Str" + currParaValue + "String_Node_Str");
      List<Individual> trainPosList=posList.getTrainList();
      List<TrainTestList> innerPosLists=getFolds(trainPosList,innerFolds);
      List<Individual> trainNegList=negList.getTrainList();
      List<TrainTestList> innerNegLists=getFolds(trainNegList,innerFolds);
      Stat paraCriterionStat=new Stat();
      for (int currInnerFold=0; currInnerFold < innerFolds; currInnerFold++) {
        System.out.println("String_Node_Str" + currInnerFold + "String_Node_Str");
        Set<Individual> posEx=new TreeSet<Individual>(innerPosLists.get(currInnerFold).getTrainList());
        Set<Individual> negEx=new TreeSet<Individual>(innerNegLists.get(currInnerFold).getTrainList());
        start=new Start(confFile);
        LearningProblem lpIn=start.getLearningProblem();
        cm.applyConfigEntry(lpIn,"String_Node_Str",Datastructures.individualSetToStringSet(posEx));
        cm.applyConfigEntry(lpIn,"String_Node_Str",Datastructures.individualSetToStringSet(negEx));
        LearningAlgorithm laIn=start.getLearningAlgorithm();
        cm.applyConfigEntry(laIn,parameter,(double)currParaValue);
        lpIn.init();
        laIn.init();
        laIn.start();
        Description concept=laIn.getCurrentlyBestDescription();
        TreeSet<Individual> posTest=new TreeSet<Individual>(innerPosLists.get(currInnerFold).getTestList());
        TreeSet<Individual> negTest=new TreeSet<Individual>(innerNegLists.get(currInnerFold).getTestList());
        ReasonerComponent rs=start.getReasonerComponent();
        Set<Individual> posCorrect=rs.hasType(concept,posTest);
        Set<Individual> posError=Helper.difference(posTest,posCorrect);
        Set<Individual> negError=rs.hasType(concept,negTest);
        Set<Individual> negCorrect=Helper.difference(negTest,negError);
        double accuracy=100 * ((double)(posCorrect.size() + negCorrect.size()) / (posTest.size() + negTest.size()));
        double precision=100 * (double)posCorrect.size() / (posCorrect.size() + negError.size());
        double recall=100 * (double)posCorrect.size() / (posCorrect.size() + posError.size());
        double fmeasure=2 * (precision * recall) / (precision + recall);
        paraCriterionStat.addNumber(accuracy);
        System.out.println("String_Node_Str" + concept.toManchesterSyntaxString(baseURI,null));
        System.out.println("String_Node_Str" + df.format(accuracy) + "String_Node_Str");
        System.out.println("String_Node_Str" + df.format(precision) + "String_Node_Str");
        System.out.println("String_Node_Str" + df.format(recall) + "String_Node_Str");
        System.out.println("String_Node_Str" + df.format(fmeasure) + "String_Node_Str");
        if (verbose) {
          System.out.println("String_Node_Str" + formatIndividualSet(posError,baseURI));
          System.out.println("String_Node_Str" + formatIndividualSet(negError,baseURI));
        }
        rs.releaseKB();
        cm.freeAllComponents();
      }
      paraStats.put(currParaValue,paraCriterionStat);
    }
    System.out.println("String_Node_Str");
    int bestPara=startValue;
    double bestValue=Double.NEGATIVE_INFINITY;
    for (    Entry<Integer,Stat> entry : paraStats.entrySet()) {
      int para=entry.getKey();
      Stat stat=entry.getValue();
      System.out.println("String_Node_Str" + para + "String_Node_Str"+ stat.prettyPrint("String_Node_Str"));
      if (stat.getMean() > bestValue) {
        bestPara=para;
        bestValue=stat.getMean();
      }
    }
    System.out.println("String_Node_Str" + bestPara + "String_Node_Str"+ df.format(bestValue)+ "String_Node_Str");
    System.out.println("String_Node_Str");
    start=new Start(confFile);
    LearningProblem lpOut=start.getLearningProblem();
    cm.applyConfigEntry(lpOut,"String_Node_Str",Datastructures.individualListToStringSet(posLists.get(currOuterFold).getTrainList()));
    cm.applyConfigEntry(lpOut,"String_Node_Str",Datastructures.individualListToStringSet(negLists.get(currOuterFold).getTrainList()));
    LearningAlgorithm laOut=start.getLearningAlgorithm();
    cm.applyConfigEntry(laOut,parameter,(double)bestPara);
    lpOut.init();
    laOut.init();
    laOut.start();
    Description concept=laOut.getCurrentlyBestDescription();
    TreeSet<Individual> posTest=new TreeSet<Individual>(posLists.get(currOuterFold).getTestList());
    TreeSet<Individual> negTest=new TreeSet<Individual>(negLists.get(currOuterFold).getTestList());
    ReasonerComponent rs=start.getReasonerComponent();
    Set<Individual> posCorrect=rs.hasType(concept,posTest);
    Set<Individual> posError=Helper.difference(posTest,posCorrect);
    Set<Individual> negError=rs.hasType(concept,negTest);
    Set<Individual> negCorrect=Helper.difference(negTest,negError);
    double accuracy=100 * ((double)(posCorrect.size() + negCorrect.size()) / (posTest.size() + negTest.size()));
    double precision=100 * (double)posCorrect.size() / (posCorrect.size() + negError.size());
    double recall=100 * (double)posCorrect.size() / (posCorrect.size() + posError.size());
    double fmeasure=2 * (precision * recall) / (precision + recall);
    System.out.println("String_Node_Str" + concept.toManchesterSyntaxString(baseURI,null));
    System.out.println("String_Node_Str" + df.format(accuracy) + "String_Node_Str");
    System.out.println("String_Node_Str" + df.format(precision) + "String_Node_Str");
    System.out.println("String_Node_Str" + df.format(recall) + "String_Node_Str");
    System.out.println("String_Node_Str" + df.format(fmeasure) + "String_Node_Str");
    if (verbose) {
      System.out.println("String_Node_Str" + formatIndividualSet(posError,baseURI));
      System.out.println("String_Node_Str" + formatIndividualSet(negError,baseURI));
    }
    accOverall.addNumber(accuracy);
    fOverall.addNumber(fmeasure);
    recallOverall.addNumber(recall);
    precisionOverall.addNumber(precision);
    rs.releaseKB();
    cm.freeAllComponents();
  }
  System.out.println();
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str" + accOverall.prettyPrint("String_Node_Str"));
  System.out.println("String_Node_Str" + fOverall.prettyPrint("String_Node_Str"));
  System.out.println("String_Node_Str" + precisionOverall.prettyPrint("String_Node_Str"));
  System.out.println("String_Node_Str" + recallOverall.prettyPrint("String_Node_Str"));
}