Skip to content

Commit

Permalink
Changing to <=
Browse files Browse the repository at this point in the history
  • Loading branch information
jzonthemtn committed Dec 10, 2024
1 parent 9dc20c7 commit 81d6a2c
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,35 +343,35 @@ public Map<Integer, Double> getRankAggregatedClickThrough() throws Exception {

}

for(int rank = 0; rank < parameters.getMaxRank(); rank++) {
// TODO: Should this be LTE or just LT? Is rank zero-based?
for(int rank = 0; rank <= parameters.getMaxRank(); rank++) {

if(impressionCounts.containsKey(rank)) {

if(clickCounts.containsKey(rank)) {

// Calculate the CTR by dividing the number of clicks by the number of impressions.
LOGGER.debug("Position = {}, Impression Counts = {}, Click Count = {}", rank, impressionCounts.get(rank), clickCounts.get(rank));
LOGGER.info("Position = {}, Impression Counts = {}, Click Count = {}", rank, impressionCounts.get(rank), clickCounts.get(rank));
rankAggregatedClickThrough.put(rank, clickCounts.get(rank) / impressionCounts.get(rank));

} else {

// This document has impressions but no clicks, so it's CTR is zero.
LOGGER.debug("Position = {}, Impression Counts = {}, No clicks so CTR is 0", rank, clickCounts.get(rank));
LOGGER.info("Position = {}, Impression Counts = {}, No clicks so CTR is 0", rank, clickCounts.get(rank));
rankAggregatedClickThrough.put(rank, 0.0);

}

} else {

// No impressions so the clickthrough rate is 0.
LOGGER.debug("No impressions for rank {}, so using CTR of 0", rank);
LOGGER.info("No impressions for rank {}, so using CTR of 0", rank);
rankAggregatedClickThrough.put(rank, (double) 0);

}

}


openSearchHelper.indexRankAggregatedClickthrough(rankAggregatedClickThrough);

return rankAggregatedClickThrough;
Expand Down

0 comments on commit 81d6a2c

Please sign in to comment.