Skip to content

Commit

Permalink
[ issue #71 ] Fixed Ideal DCG calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
agazzarini committed Jan 16, 2019
1 parent b62879f commit b77bf5a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ private BigDecimal idealDcg(final JsonNode relevantDocuments) {

Arrays.fill(gains, 0, howManyVeryVeryRelevantDocs, 3);
if (howManyVeryVeryRelevantDocs < windowSize) {
Arrays.fill(gains, howManyVeryVeryRelevantDocs, howManyVeryVeryRelevantDocs + Math.min((windowSize - howManyVeryVeryRelevantDocs), howManyVeryRelevantDocs), 1);
Arrays.fill(gains, howManyVeryVeryRelevantDocs, howManyVeryVeryRelevantDocs + howManyVeryRelevantDocs, 2);
}

if (howManyVeryVeryRelevantDocs + howManyVeryRelevantDocs < windowSize) {
Arrays.fill(gains, howManyVeryVeryRelevantDocs + howManyVeryRelevantDocs, gains.length - 1, 1);
}

BigDecimal result = gains.length > 0 ? new BigDecimal(gains[0]) : BigDecimal.ZERO;
Expand Down

0 comments on commit b77bf5a

Please sign in to comment.