Program: 109349
Project: 109349
Buggy source:
@Override public EvaluationResult evaluate(final MyrrixRecommender recommender,final RescorerProvider provider,final Multimap<Long,RecommendedItem> testData) throws TasteException {
  final Mean precision=new Mean();
  final Mean recall=new Mean();
  final Mean ndcg=new Mean();
  final Mean meanAveragePrecision=new Mean();
  Processor<Long> processor=new Processor<Long>(){
    @Override public void process(    Long userID,    long count){
      Collection<RecommendedItem> values=testData.get(userID);
      int numValues=values.size();
      if (numValues == 0) {
        return;
      }
      IDRescorer rescorer=provider == null ? null : provider.getRecommendRescorer(new long[]{userID},recommender);
      List<RecommendedItem> recs;
      try {
        recs=recommender.recommend(userID,numValues,rescorer);
      }
 catch (      NoSuchUserException nsue) {
        log.warn("String_Node_Str",userID);
        return;
      }
catch (      TasteException te) {
        log.warn("String_Node_Str",te);
        return;
      }
      int numRecs=recs.size();
      Collection<Long> valueIDs=Sets.newHashSet();
      for (      RecommendedItem rec : values) {
        valueIDs.add(rec.getItemID());
      }
      int intersectionSize=0;
      double score=0.0;
      double maxScore=0.0;
      Mean precisionAtI=new Mean();
      double averagePrecision=0.0;
      for (int i=0; i < numRecs; i++) {
        RecommendedItem rec=recs.get(i);
        double value=LN2 / Math.log(2.0 + i);
        if (valueIDs.contains(rec.getItemID())) {
          intersectionSize++;
          score+=value;
          precisionAtI.increment(1.0);
          averagePrecision+=precisionAtI.getResult();
        }
 else {
          precisionAtI.increment(0.0);
        }
        maxScore+=value;
      }
      averagePrecision/=numValues;
synchronized (precision) {
        precision.increment(numRecs == 0 ? 0.0 : (double)intersectionSize / numRecs);
        recall.increment((double)intersectionSize / numValues);
        ndcg.increment(maxScore == 0.0 ? 0.0 : score / maxScore);
        meanAveragePrecision.increment(averagePrecision);
        if (count % 10000 == 0) {
          log.info(new IRStatisticsImpl(precision.getResult(),recall.getResult(),ndcg.getResult(),meanAveragePrecision.getResult()).toString());
        }
      }
    }
  }
;
  Paralleler<Long> paralleler=new Paralleler<Long>(testData.keySet().iterator(),processor,"String_Node_Str");
  try {
    if (Boolean.parseBoolean(System.getProperty("String_Node_Str","String_Node_Str"))) {
      paralleler.runInParallel();
    }
 else {
      paralleler.runInSerial();
    }
  }
 catch (  InterruptedException ie) {
    throw new TasteException(ie);
  }
catch (  ExecutionException e) {
    throw new TasteException(e.getCause());
  }
  EvaluationResult result=new IRStatisticsImpl(precision.getResult(),recall.getResult(),ndcg.getResult(),meanAveragePrecision.getResult());
  log.info(result.toString());
  return result;
}

Fixed version (ground truth):
@Override public EvaluationResult evaluate(final MyrrixRecommender recommender,final RescorerProvider provider,final Multimap<Long,RecommendedItem> testData) throws TasteException {
  final Mean precision=new Mean();
  final Mean recall=new Mean();
  final Mean ndcg=new Mean();
  final Mean meanAveragePrecision=new Mean();
  Processor<Long> processor=new Processor<Long>(){
    @Override public void process(    Long userID,    long count){
      Collection<RecommendedItem> values=testData.get(userID);
      int numValues=values.size();
      if (numValues == 0) {
        return;
      }
      IDRescorer rescorer=provider == null ? null : provider.getRecommendRescorer(new long[]{userID},recommender);
      List<RecommendedItem> recs;
      try {
        recs=recommender.recommend(userID,numValues,rescorer);
      }
 catch (      NoSuchUserException nsue) {
        log.warn("String_Node_Str",userID);
        return;
      }
catch (      TasteException te) {
        log.warn("String_Node_Str",te);
        return;
      }
      int numRecs=recs.size();
      Collection<Long> valueIDs=Sets.newHashSet();
      for (      RecommendedItem rec : values) {
        valueIDs.add(rec.getItemID());
      }
      int intersectionSize=0;
      double score=0.0;
      double maxScore=0.0;
      Mean precisionAtI=new Mean();
      double averagePrecision=0.0;
      for (int i=0; i < numRecs; i++) {
        RecommendedItem rec=recs.get(i);
        double value=LN2 / Math.log(2.0 + i);
        if (valueIDs.contains(rec.getItemID())) {
          intersectionSize++;
          score+=value;
          precisionAtI.increment(1.0);
          averagePrecision+=precisionAtI.getResult();
        }
 else {
          precisionAtI.increment(0.0);
        }
        maxScore+=value;
      }
      averagePrecision/=numValues;
synchronized (precision) {
        precision.increment(numRecs == 0 ? 0.0 : (double)intersectionSize / numRecs);
        recall.increment((double)intersectionSize / numValues);
        ndcg.increment(maxScore == 0.0 ? 0.0 : score / maxScore);
        meanAveragePrecision.increment(averagePrecision);
        if (count % 10000 == 0) {
          log.info(new IRStatisticsImpl(precision.getResult(),recall.getResult(),ndcg.getResult(),meanAveragePrecision.getResult()).toString());
        }
      }
    }
  }
;
  Paralleler<Long> paralleler=new Paralleler<Long>(testData.keySet().iterator(),processor,"String_Node_Str");
  try {
    if (Boolean.parseBoolean(System.getProperty("String_Node_Str","String_Node_Str"))) {
      paralleler.runInParallel();
    }
 else {
      paralleler.runInSerial();
    }
  }
 catch (  InterruptedException ie) {
    throw new TasteException(ie);
  }
catch (  ExecutionException e) {
    throw new TasteException(e.getCause());
  }
  EvaluationResult result;
  if (precision.getN() > 0) {
    result=new IRStatisticsImpl(precision.getResult(),recall.getResult(),ndcg.getResult(),meanAveragePrecision.getResult());
  }
 else {
    result=null;
  }
  log.info(String.valueOf(result));
  return result;
}