public class UserUserItemScorer extends AbstractItemScorer
Score items with user-user collaborative filtering.
The detailed results returned by this scorer are of type UserUserResult
.
Modifier and Type | Field and Description |
---|---|
protected NeighborFinder |
neighborFinder |
protected UserVectorNormalizer |
normalizer |
Constructor and Description |
---|
UserUserItemScorer(RatingVectorPDAO rvd,
NeighborFinder nf,
UserVectorNormalizer norm,
int nnbrs,
int minNbrs,
Threshold thresh) |
Modifier and Type | Method and Description |
---|---|
protected Long2ObjectMap<? extends Collection<Neighbor>> |
findNeighbors(long user,
LongSet items)
Find the neighbors for a user with respect to a collection of items.
|
protected Long2ObjectMap<SparseVector> |
normalizeNeighborRatings(Collection<? extends Collection<Neighbor>> neighborhoods)
Normalize all neighbor rating vectors, taking care to normalize each one only once.
|
ResultMap |
scoreWithDetails(long user,
Collection<Long> items)
Score a collection of items and potentially return more details on the scores.
|
score, score
protected final NeighborFinder neighborFinder
protected final UserVectorNormalizer normalizer
@Inject public UserUserItemScorer(RatingVectorPDAO rvd, NeighborFinder nf, UserVectorNormalizer norm, @NeighborhoodSize int nnbrs, @MinNeighbors int minNbrs, @UserSimilarityThreshold Threshold thresh)
protected Long2ObjectMap<SparseVector> normalizeNeighborRatings(Collection<? extends Collection<Neighbor>> neighborhoods)
Normalize all neighbor rating vectors, taking care to normalize each one only once.
FIXME: MDE does not like this method.
neighborhoods
- @Nonnull public ResultMap scoreWithDetails(long user, @Nonnull Collection<Long> items)
ItemScorer
Score a collection of items and potentially return more details on the scores.
user
- The user ID for whom to generate scores.items
- The item to score.ResultMap
that provides access to those details.protected Long2ObjectMap<? extends Collection<Neighbor>> findNeighbors(long user, @Nonnull LongSet items)
Find the neighbors for a user with respect to a collection of items. For each item, the neighborhoodSize users closest to the provided user are returned.
user
- The user’s rating vector.items
- The items for which neighborhoods are requested.