public class ItemItemScorer extends AbstractItemScorer
Score items using an item-item CF model. User ratings are not supplied as default preferences.
Modifier and Type | Field and Description |
---|---|
protected ItemItemModel |
model |
protected UserVectorNormalizer |
normalizer |
protected NeighborhoodScorer |
scorer |
Constructor and Description |
---|
ItemItemScorer(RatingVectorPDAO dao,
ItemItemModel m,
NeighborhoodScorer scorer,
UserVectorNormalizer norm,
int nnbrs,
int min)
Construct a new item-item scorer.
|
Modifier and Type | Method and Description |
---|---|
UserVectorNormalizer |
getNormalizer() |
java.util.Map<java.lang.Long,java.lang.Double> |
score(long user,
java.util.Collection<java.lang.Long> items)
Score a collection of items.
|
protected void |
scoreItem(Long2DoubleMap userData,
long item,
ItemItemScoreAccumulator accum) |
ResultMap |
scoreWithDetails(long user,
java.util.Collection<java.lang.Long> items)
Score items by computing predicted ratings.
|
score
protected final ItemItemModel model
@Nonnull protected final UserVectorNormalizer normalizer
@Nonnull protected final NeighborhoodScorer scorer
@Inject public ItemItemScorer(RatingVectorPDAO dao, ItemItemModel m, NeighborhoodScorer scorer, UserVectorNormalizer norm, @NeighborhoodSize int nnbrs, @MinNeighbors int min)
Construct a new item-item scorer.
dao
- The rating vector DAO.m
- The modelscorer
- The neighborhood scorer.nnbrs
- The number of neighbors.min
- The minimum number of neighbors.@Nonnull public UserVectorNormalizer getNormalizer()
@Nonnull public java.util.Map<java.lang.Long,java.lang.Double> score(long user, @Nonnull java.util.Collection<java.lang.Long> items)
AbstractItemScorer
Score a collection of items.
This implementation delegates to ItemScorer.scoreWithDetails(long, Collection)
.
score
in interface ItemScorer
score
in class AbstractItemScorer
user
- The user ID for whom to generate scores.items
- The item to score.@Nonnull public ResultMap scoreWithDetails(long user, @Nonnull java.util.Collection<java.lang.Long> items)
Score items by computing predicted ratings.
user
- The user ID for whom to generate scores.items
- The item to score.ResultMap
that provides access to those details.protected void scoreItem(Long2DoubleMap userData, long item, ItemItemScoreAccumulator accum)