public class UserUserItemScorer extends AbstractItemScorer
Modifier and Type | Field and Description |
---|---|
protected NeighborFinder |
neighborFinder |
static Symbol |
NEIGHBORHOOD_SIZE_SYMBOL |
static Symbol |
NEIGHBORHOOD_WEIGHT_SYMBOL |
protected UserVectorNormalizer |
normalizer |
Constructor and Description |
---|
UserUserItemScorer(UserEventDAO dao,
NeighborFinder nf,
UserVectorNormalizer norm,
int nnbrs,
int minNbrs,
Threshold thresh) |
Modifier and Type | Method and Description |
---|---|
protected Long2ObjectMap<? extends Collection<Neighbor>> |
findNeighbors(UserHistory<? extends Event> 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.
|
void |
score(long user,
MutableSparseVector scores)
Score items in a vector.
|
score, score
public static final Symbol NEIGHBORHOOD_SIZE_SYMBOL
public static final Symbol NEIGHBORHOOD_WEIGHT_SYMBOL
protected final NeighborFinder neighborFinder
protected final UserVectorNormalizer normalizer
@Inject public UserUserItemScorer(UserEventDAO dao, NeighborFinder nf, UserVectorNormalizer norm, @NeighborhoodSize int nnbrs, @MinNeighbors int minNbrs, @UserSimilarityThreshold Threshold thresh)
protected Long2ObjectMap<SparseVector> normalizeNeighborRatings(Collection<? extends Collection<Neighbor>> neighborhoods)
neighborhoods
- public void score(long user, @Nonnull MutableSparseVector scores)
ItemScorer
user
- The user ID.scores
- The score vector.protected Long2ObjectMap<? extends Collection<Neighbor>> findNeighbors(@Nonnull UserHistory<? extends Event> user, @Nonnull LongSet items)
user
- The user's rating vector.items
- The items for which neighborhoods are requested.