public class TopNGlobalItemRecommender extends AbstractGlobalItemRecommender
Modifier and Type | Class and Description |
---|---|
static class |
TopNGlobalItemRecommender.Provider
An intelligent provider for Top-N global recommenders.
|
Modifier and Type | Field and Description |
---|---|
protected ItemDAO |
itemDAO |
protected GlobalItemScorer |
scorer |
Constructor and Description |
---|
TopNGlobalItemRecommender(ItemDAO idao,
GlobalItemScorer scorer) |
Modifier and Type | Method and Description |
---|---|
protected LongSet |
getDefaultExcludes(LongSet items)
Get the default exclude set for a item in the global recommendation.
|
protected List<ScoredId> |
globalRecommend(LongSet items,
int n,
LongSet candidates,
LongSet exclude)
Implement the ID-based recommendation in terms of the scorer.
|
protected List<ScoredId> |
recommend(int n,
SparseVector scores)
Pick the top n items from a score vector.
|
globalRecommend, globalRecommend, globalRecommend, globalRecommend
protected final ItemDAO itemDAO
protected final GlobalItemScorer scorer
public TopNGlobalItemRecommender(ItemDAO idao, GlobalItemScorer scorer)
protected List<ScoredId> globalRecommend(LongSet items, int n, LongSet candidates, LongSet exclude)
getDefaultExcludes(LongSet)
to supply a missing exclude set.globalRecommend
in class AbstractGlobalItemRecommender
items
- The items ID.n
- The number of items to return, or negative to return all
possible items.candidates
- The candidate set.exclude
- The set of excluded items, or null
to use the
default exclude set.GlobalItemRecommender.globalRecommend(Set, int, Set, Set)
protected LongSet getDefaultExcludes(LongSet items)
items
- The items for which we are recommending.protected List<ScoredId> recommend(int n, SparseVector scores)
n
- The number of items to recommend.scores
- The scored item vector.