public abstract class AbstractItemRecommender extends Object implements ItemRecommender
ItemRecommender by delegating them to general methods with
fastutil-based interfaces.| Constructor and Description |
|---|
AbstractItemRecommender() |
| Modifier and Type | Method and Description |
|---|---|
List<ScoredId> |
recommend(long user)
Recommend all possible items for a user using the default exclude set.
|
List<ScoredId> |
recommend(long user,
int n)
Recommend up to n items for a user using the default exclude
set.
|
protected abstract List<ScoredId> |
recommend(long user,
int n,
LongSet candidates,
LongSet exclude)
Implementation method for ID-based recommendation.
|
List<ScoredId> |
recommend(long user,
int n,
Set<Long> candidates,
Set<Long> exclude)
Produce a set of recommendations for the user.
|
List<ScoredId> |
recommend(long user,
Set<Long> candidates)
Recommend all possible items for a user from a set of candidates using
the default exclude set.
|
public List<ScoredId> recommend(long user)
Delegates to recommend(long, int, LongSet, LongSet).
recommend in interface ItemRecommenderuser - The user ID.ItemRecommender.recommend(long, int, Set, Set)public List<ScoredId> recommend(long user, int n)
Delegates to recommend(long, int, LongSet, LongSet).
recommend in interface ItemRecommenderuser - The user ID.n - The number of recommendations to return.ItemRecommender.recommend(long, int, Set, Set)public List<ScoredId> recommend(long user, Set<Long> candidates)
Delegates to recommend(long, int, LongSet, LongSet).
recommend in interface ItemRecommenderuser - The user ID.candidates - The candidate set (can be null to represent the
universe).ItemRecommender.recommend(long, int, Set, Set)public List<ScoredId> recommend(long user, int n, @Nullable Set<Long> candidates, @Nullable Set<Long> exclude)
Delegates to recommend(long, int, LongSet, LongSet).
recommend in interface ItemRecommenderuser - The user's IDn - The number of ratings to return. If negative, there is
no specific recommendation list size requested.candidates - A set of candidate items which can be recommended. If
null, all items are considered candidates.exclude - A set of items to be excluded. If null, a default
exclude set is used.Double.NaN. For
most scoring recommenders, the items will be ordered in
decreasing order of score. This is not a hard requirement — e.g.
set recommenders are allowed to be more flexible.protected abstract List<ScoredId> recommend(long user, int n, @Nullable LongSet candidates, @Nullable LongSet exclude)
user - The user ID.n - The number of items to return, or negative to return all possible items.candidates - The candidate set, or null to use a default set of candidates.exclude - The set of excluded items, or null to use the default exclude set.ItemRecommender.recommend(long, int, Set, Set)