@Shareable public class PrecomputedItemScorer extends AbstractItemScorer implements java.io.Serializable
An item scorer that stores a precomputed map of item scores.
| Modifier and Type | Class and Description |
|---|---|
static class |
PrecomputedItemScorer.Builder
Builder for mock item scorers.
|
| Modifier and Type | Method and Description |
|---|---|
static PrecomputedItemScorer |
fromCSV(java.io.BufferedReader buf)
Read predictions from a CSV file.
|
static PrecomputedItemScorer.Builder |
newBuilder()
Construct a new builder for precomputed item scorers.
|
Result |
score(long user,
long item)
Score a single item.
|
ResultMap |
scoreWithDetails(long user,
java.util.Collection<java.lang.Long> items)
Score a collection of items and potentially return more details on the scores.
|
scorepublic Result score(long user, long item)
AbstractItemScorerScore a single item.
This implementation delegates to ItemScorer.scoreWithDetails(long, Collection).
score in interface ItemScorerscore in class AbstractItemScoreruser - The user ID for whom to generate a score.item - The item ID to score.null if no score can be generated.@Nonnull public ResultMap scoreWithDetails(long user, @Nonnull java.util.Collection<java.lang.Long> items)
ItemScorerScore a collection of items and potentially return more details on the scores.
scoreWithDetails in interface ItemScoreruser - The user ID for whom to generate scores.items - The item to score.ResultMap that provides access to those details.public static PrecomputedItemScorer fromCSV(@WillClose java.io.BufferedReader buf)
Read predictions from a CSV file.
buf - A CSV file reader.public static PrecomputedItemScorer.Builder newBuilder()
Construct a new builder for precomputed item scorers. This is useful for building item scorers for mocks.