@Shareable public class ConstantItemScorer extends Object implements ItemScorer, Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
ConstantItemScorer.Value
Parameter: the value used by the constant scorer.
|
Constructor and Description |
---|
ConstantItemScorer(double val)
Construct a new constant scorer.
|
Modifier and Type | Method and Description |
---|---|
SparseVector |
score(long user,
Collection<Long> items)
Score a collection of items.
|
double |
score(long user,
long item)
Score a single item.
|
void |
score(long user,
MutableSparseVector output)
Score items in a vector.
|
String |
toString() |
@Inject public ConstantItemScorer(@ConstantItemScorer.Value double val)
val
- The value to use.public double score(long user, long item)
ItemScorer
score
in interface ItemScorer
user
- The user ID for whom to generate a score.item
- The item ID to score.Double.NaN
if no score can be generated.@Nonnull public SparseVector score(long user, @Nonnull Collection<Long> items)
ItemScorer
score
in interface ItemScorer
user
- The user ID for whom to generate scores.items
- The item to score.public void score(long user, @Nonnull MutableSparseVector output)
ItemScorer
score
in interface ItemScorer
user
- The user ID.output
- The score vector.