public class PrecomputedItemScorer extends AbstractItemScorer implements 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(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,
Collection<Long> items)
Score a collection of items and potentially return more details on the scores.
|
score
public Result score(long user, long item)
AbstractItemScorer
Score a single item.
This implementation delegates to ItemScorer.scoreWithDetails(long, Collection)
.
score
in interface ItemScorer
score
in class AbstractItemScorer
user
- 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 Collection<Long> items)
ItemScorer
Score a collection of items and potentially return more details on the scores.
scoreWithDetails
in interface ItemScorer
user
- 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 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.