Program: 9696
Project: 9696
Buggy source:
/** 
 * Computes score of a given concept using the reasoner. Either retrieval or instance check are used. For the latter, this method treats <code>UseMultiInstanceChecks.TWO_CHECKS</code> as if it were  <code>UseMultiInstanceChecks.ONE_CHECKS</code> (it does not make much sense to implement TWO_CHECKS in this function, because we have to test all examples to create a score object anyway).
 * @see org.dllearner.learningproblems.PosNegLP.UseMultiInstanceChecks
 * @param concept The concept to test.
 * @return Corresponding Score object.
 */
@Override public ScorePosNeg computeScore(Description concept){
  if (useRetrievalForClassification) {
    SortedSet<Individual> posClassified=reasoner.getIndividuals(concept);
    SortedSet<Individual> posAsPos=Helper.intersection(positiveExamples,posClassified);
    SortedSet<Individual> negAsPos=Helper.intersection(negativeExamples,posClassified);
    SortedSet<Individual> posAsNeg=new TreeSet<Individual>();
    for (    Individual posExample : positiveExamples) {
      if (!posClassified.contains(posExample))       posAsNeg.add(posExample);
    }
    SortedSet<Individual> negAsNeg=new TreeSet<Individual>();
    for (    Individual negExample : negativeExamples) {
      if (!posClassified.contains(negExample))       negAsNeg.add(negExample);
    }
    return new ScoreTwoValued(concept.getLength(),percentPerLengthUnit,posAsPos,posAsNeg,negAsPos,negAsNeg);
  }
 else {
    SortedSet<Individual> posAsPos=new TreeSet<Individual>();
    SortedSet<Individual> posAsNeg=new TreeSet<Individual>();
    SortedSet<Individual> negAsPos=new TreeSet<Individual>();
    SortedSet<Individual> negAsNeg=new TreeSet<Individual>();
    if (useMultiInstanceChecks != UseMultiInstanceChecks.NEVER) {
      SortedSet<Individual> posClassified=reasoner.hasType(concept,allExamples);
      SortedSet<Individual> negClassified=Helper.difference(allExamples,posClassified);
      posAsPos=Helper.intersection(positiveExamples,posClassified);
      posAsNeg=Helper.intersection(positiveExamples,negClassified);
      negAsPos=Helper.intersection(negativeExamples,posClassified);
      negAsNeg=Helper.intersection(negativeExamples,negClassified);
      return new ScoreTwoValued(concept.getLength(),percentPerLengthUnit,posAsPos,posAsNeg,negAsPos,negAsNeg);
    }
 else {
      for (      Individual example : positiveExamples) {
        if (reasoner.hasType(concept,example)) {
          posAsPos.add(example);
        }
 else {
          posAsNeg.add(example);
        }
      }
      for (      Individual example : negativeExamples) {
        if (reasoner.hasType(concept,example))         negAsPos.add(example);
 else         negAsNeg.add(example);
      }
      return new ScoreTwoValued(concept.getLength(),percentPerLengthUnit,posAsPos,posAsNeg,negAsPos,negAsNeg);
    }
  }
}

Fixed version (ground truth):
/** 
 * Computes score of a given concept using the reasoner. Either retrieval or instance check are used. For the latter, this method treats <code>UseMultiInstanceChecks.TWO_CHECKS</code> as if it were  <code>UseMultiInstanceChecks.ONE_CHECKS</code> (it does not make much sense to implement TWO_CHECKS in this function, because we have to test all examples to create a score object anyway). NOTE: The options above are no longer supported, because of interface changes (the options are more or less only relevant in combination with DIG).
 * @see org.dllearner.learningproblems.PosNegLP.UseMultiInstanceChecks
 * @param concept The concept to test.
 * @return Corresponding Score object.
 */
@Override public ScorePosNeg computeScore(Description concept){
  if (useOldDIGOptions) {
    if (useRetrievalForClassification) {
      SortedSet<Individual> posClassified=reasoner.getIndividuals(concept);
      SortedSet<Individual> posAsPos=Helper.intersection(positiveExamples,posClassified);
      SortedSet<Individual> negAsPos=Helper.intersection(negativeExamples,posClassified);
      SortedSet<Individual> posAsNeg=new TreeSet<Individual>();
      for (      Individual posExample : positiveExamples) {
        if (!posClassified.contains(posExample))         posAsNeg.add(posExample);
      }
      SortedSet<Individual> negAsNeg=new TreeSet<Individual>();
      for (      Individual negExample : negativeExamples) {
        if (!posClassified.contains(negExample))         negAsNeg.add(negExample);
      }
      return new ScoreTwoValued(concept.getLength(),percentPerLengthUnit,posAsPos,posAsNeg,negAsPos,negAsNeg);
    }
 else {
      SortedSet<Individual> posAsPos=new TreeSet<Individual>();
      SortedSet<Individual> posAsNeg=new TreeSet<Individual>();
      SortedSet<Individual> negAsPos=new TreeSet<Individual>();
      SortedSet<Individual> negAsNeg=new TreeSet<Individual>();
      if (useMultiInstanceChecks != UseMultiInstanceChecks.NEVER) {
        SortedSet<Individual> posClassified=reasoner.hasType(concept,allExamples);
        SortedSet<Individual> negClassified=Helper.difference(allExamples,posClassified);
        posAsPos=Helper.intersection(positiveExamples,posClassified);
        posAsNeg=Helper.intersection(positiveExamples,negClassified);
        negAsPos=Helper.intersection(negativeExamples,posClassified);
        negAsNeg=Helper.intersection(negativeExamples,negClassified);
        return new ScoreTwoValued(concept.getLength(),percentPerLengthUnit,posAsPos,posAsNeg,negAsPos,negAsNeg);
      }
 else {
        for (        Individual example : positiveExamples) {
          if (reasoner.hasType(concept,example)) {
            posAsPos.add(example);
          }
 else {
            posAsNeg.add(example);
          }
        }
        for (        Individual example : negativeExamples) {
          if (reasoner.hasType(concept,example))           negAsPos.add(example);
 else           negAsNeg.add(example);
        }
        return new ScoreTwoValued(concept.getLength(),percentPerLengthUnit,posAsPos,posAsNeg,negAsPos,negAsNeg);
      }
    }
  }
 else {
    SortedSet<Individual> posAsPos=new TreeSet<Individual>();
    SortedSet<Individual> posAsNeg=new TreeSet<Individual>();
    SortedSet<Individual> negAsPos=new TreeSet<Individual>();
    SortedSet<Individual> negAsNeg=new TreeSet<Individual>();
    for (    Individual example : positiveExamples) {
      if (reasoner.hasType(concept,example)) {
        posAsPos.add(example);
      }
 else {
        posAsNeg.add(example);
      }
    }
    for (    Individual example : negativeExamples) {
      if (reasoner.hasType(concept,example))       negAsPos.add(example);
 else       negAsNeg.add(example);
    }
    double accuracy=getAccuracyOrTooWeakExact(concept,1);
    return new ScoreTwoValued(concept.getLength(),percentPerLengthUnit,posAsPos,posAsNeg,negAsPos,negAsNeg,accuracy);
  }
}