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 |
static Symbol |
NEIGHBORHOOD_SIZE_SYMBOL |
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() |
Map<Long,Double> |
score(long user,
Collection<Long> items)
Score a collection of items.
|
protected void |
scoreItem(Long2DoubleMap userData,
long item,
ItemItemScoreAccumulator accum) |
ResultMap |
scoreWithDetails(long user,
Collection<Long> items)
Score items by computing predicted ratings.
|
score
public static final Symbol NEIGHBORHOOD_SIZE_SYMBOL
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 Map<Long,Double> score(long user, @Nonnull Collection<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 Collection<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)