public class RankBlendingItemRecommender extends AbstractItemRecommender
Hybrid item recommender that blends the ranks produced by two recommenders.
This recommender takes two recommenders, left and right, and asks them each to produce recommendations. The final rank for each item is computed by the weighted score of its rank score. If a recommender produces a list $L$ of $n$ recommendations $i_0, i_1, \dots, i_n$, with the rank denoted by $k$, the rank fraction is $1-\frac{k}{n-1}$. That is, the first-ranked item has score 1 and the last 0.
The final ranking is done by linearly blending the sub-recommender rank scores using the specified blending weight.
This method was devised by Max Harper for use in MovieLens.
Modifier and Type | Class and Description |
---|---|
static interface |
RankBlendingItemRecommender.Left
The ‘left’ recommender for the blending recommender.
|
static interface |
RankBlendingItemRecommender.Right
The ‘right’ recommender for a hybrid.
|
Constructor and Description |
---|
RankBlendingItemRecommender(ItemRecommender left,
ItemRecommender right,
double w)
Construct a new rank-blending recommender.
|
Modifier and Type | Method and Description |
---|---|
protected ResultList |
recommendWithDetails(long user,
int n,
LongSet candidates,
LongSet exclude)
Primary method for implementing an item recommender.
|
recommend, recommend, recommend, recommend, recommendWithDetails
@Inject public RankBlendingItemRecommender(@RankBlendingItemRecommender.Left ItemRecommender left, @RankBlendingItemRecommender.Right ItemRecommender right, @BlendWeight double w)
Construct a new rank-blending recommender.
left
- The left recommender.right
- The right recommender.w
- The blending weight.protected ResultList recommendWithDetails(long user, int n, @Nullable LongSet candidates, @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.candidates
- The candidate items, or null
for default.exclude
- The exclude set, or null
for default.AbstractItemRecommender.recommendWithDetails(long, int, Set, Set)