}
@Override
public void predict(long user, @Nonnull MutableSparseVector scores) {
scorer.score(user, scores);
LongSet fallbackKeys = LongSets.EMPTY_SET;
if (baselineScorer != null) {
fallbackKeys = scores.unsetKeySet();
MutableSparseVector unpred = MutableSparseVector.create(fallbackKeys);
baselineScorer.score(user, unpred);
scores.set(unpred);
}
// FIXME Make this faster
Long2ObjectMap<ScoreSource> chan = scores.getOrAddChannel(PREDICTION_SOURCE_SYMBOL);
for (VectorEntry e: scores) {
long key = e.getKey();
ScoreSource source = ScoreSource.PRIMARY;
if (fallbackKeys.contains(key)) {
source = ScoreSource.BASELINE;
}
chan.put(key, source);
}