예제 #1
0
 private Collection<ScoreItem> integrate(
     List<Set<ScoreItem>> list, ScoreType scoreType, Mode mode) {
   Map<String, ScoreItem> map = new HashMap<>();
   for (Set<ScoreItem> input : list) {
     for (ScoreItem item : input) {
       if ((mode == Mode.FILTER || mode == Mode.LPGN)
           && item.getScoreByType(ScoreType.Q_VALUE).getValue() >= 0.01) continue;
       Score score = item.getScoreByType(scoreType);
       if (mode == Mode.HOUSE_KEEPING) {
         double p = Math.pow(10.0, -score.getValue());
         score.setValue(getLp(1.0 - p));
       }
       ScoreItem prev = map.get(item.getId());
       if (prev == null) {
         map.put(item.getId(), item);
         if (mode == Mode.FILTER || mode == Mode.LPGN)
           item.putScore(new Score(ScoreType.ID_COUNT, 1));
       } else {
         Score prevScore = prev.getScoreByType(scoreType);
         if (mode == Mode.LPG1 || mode == Mode.BEST || mode == Mode.FILTER)
           prevScore.setValue(Math.max(prevScore.getValue(), score.getValue()));
         else prevScore.setValue(prevScore.getValue() + score.getValue());
         if (mode == Mode.FILTER || mode == Mode.LPGN) {
           Score countScore = prev.getScoreByType(ScoreType.ID_COUNT);
           countScore.setValue(countScore.getValue() + 1);
         }
       }
     }
   }
   return map.values();
 }
예제 #2
0
 private void finalize(Collection<ScoreItem> items, ScoreType scoreType, int n, Mode mode) {
   if (mode == Mode.BEST || mode == Mode.FILTER) return;
   for (ScoreItem item : items) {
     Score score = item.getScoreByType(scoreType);
     switch (mode) {
       case LPG1:
         double p = Math.pow(10.0, -score.getValue());
         score.setValue(getLp(1.0 - Math.pow(1.0 - p, n)));
         break;
       case LPG:
         score.setValue(getLp(gamma(score.getValue(), n)));
         break;
       case LPGN:
         finalizeLpgn(score, item.getScoreByType(ScoreType.ID_COUNT), n);
         break;
       case HOUSE_KEEPING:
         score.setValue(getLp(1.0 - gamma(score.getValue(), n)));
         break;
       default:
         return;
     }
   }
 }