public class GreedyRerankingItemRecommender extends AbstractItemRecommender
A hybrid item recommender that uses a greedy re-ranking strategy to allow re-ranking of items iteratively. This general algorithm is commonly employed to efficiently optimize for set properties of a recommendation list such as inter-item diveristy.
This algorithm takes a baseline ranking algorithm, gets the top-n recommendations and re-ranks them iteratively. To select each recommended item, first a scoring algorithm is ran based on the currently selected recommendations and each candidate item. The item with the highest score is then added to the recommended list. This process repeates until enough items are recommended.
Constructor and Description |
---|
GreedyRerankingItemRecommender(ItemRecommender baseRecommender,
GreedyRerankStrategy strategy) |
Modifier and Type | Method and Description |
---|---|
protected ResultList |
recommendWithDetails(long user,
int n,
LongSet candidateItems,
LongSet exclude)
Primary method for implementing an item recommender.
|
recommend, recommend, recommend, recommend, recommendWithDetails
@Inject public GreedyRerankingItemRecommender(ItemRecommender baseRecommender, GreedyRerankStrategy strategy)
protected ResultList recommendWithDetails(long user, int n, @Nullable LongSet candidateItems, @Nullable LongSet exclude)
AbstractItemRecommender
Primary method for implementing an item recommender.
recommendWithDetails
in class AbstractItemRecommender
user
- The user ID.n
- The number of recommendations to produce, or a negative value to produce unlimited recommendations.candidateItems
- The candidate items, or null
for default.exclude
- The exclude set, or null
for default.AbstractItemRecommender.recommendWithDetails(long, int, Set, Set)