this.rescorer = rescorer;
}
@Override
public double estimate(Long itemID) throws TasteException {
RunningAverage average = new FullRunningAverage();
double[] similarities = similarity.itemSimilarities(itemID, toItemIDs);
for (int i = 0; i < toItemIDs.length; i++) {
long toItemID = toItemIDs[i];
LongPair pair = new LongPair(toItemID, itemID);
if ((rescorer != null) && rescorer.isFiltered(pair)) {
continue;
}
double estimate = similarities[i];
if (rescorer != null) {
estimate = rescorer.rescore(pair, estimate);
}
average.addDatum(estimate);
}
return average.getAverage();
}