public abstract class AbstractItemBasedItemRecommender extends Object implements ItemBasedItemRecommender
Base class to make it easier to implement ItemBasedItemRecommender
. All methods delegate to ItemBasedItemRecommender.recommendRelatedItemsWithDetails(Set, int, Set, Set)
.
Constructor and Description |
---|
AbstractItemBasedItemRecommender() |
Modifier and Type | Method and Description |
---|---|
List<Long> |
recommendRelatedItems(long reference)
Recommend all possible items for a reference item using the default exclude set.
|
List<Long> |
recommendRelatedItems(long reference,
int n)
Recommend up to n possible items for a reference item using the default exclude set.
|
List<Long> |
recommendRelatedItems(Set<Long> basket)
Recommend all possible items for a set of reference items using the default exclude set.
|
List<Long> |
recommendRelatedItems(Set<Long> basket,
int n)
Recommend up to n items for a set of reference items using the default exclude set.
|
List<Long> |
recommendRelatedItems(Set<Long> basket,
int n,
Set<Long> candidates,
Set<Long> exclude)
Produce a set of recommendations for the item.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
recommendRelatedItemsWithDetails
public List<Long> recommendRelatedItems(long reference, int n)
Recommend up to n possible items for a reference item using the default exclude set.
This implementation delegates to recommendRelatedItems(Set, int)
.
recommendRelatedItems
in interface ItemBasedItemRecommender
reference
- The reference item.n
- The number of items to recommend (< 0 for unlimited).ItemBasedItemRecommender.recommendRelatedItems(Set, int, Set, Set)
public List<Long> recommendRelatedItems(long reference)
Recommend all possible items for a reference item using the default exclude set.
This implementation delegates to recommendRelatedItems(long, int)
with a size of -1.
recommendRelatedItems
in interface ItemBasedItemRecommender
reference
- The reference item.ItemBasedItemRecommender.recommendRelatedItems(Set, int, Set, Set)
public List<Long> recommendRelatedItems(Set<Long> basket, int n, @Nullable Set<Long> candidates, @Nullable Set<Long> exclude)
Produce a set of recommendations for the item. This method allows the recommendations to be constrained by both a candidate set and an exclude set. The exclude set is applied to the candidate set, so the final effective candidate set is candidates minus exclude.
This implementation delegates to ItemBasedItemRecommender.recommendRelatedItemsWithDetails(Set, int, Set, Set)
.
recommendRelatedItems
in interface ItemBasedItemRecommender
basket
- The reference items.n
- The number of ratings to return. If negative, no specific size is 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.public List<Long> recommendRelatedItems(Set<Long> basket, int n)
Recommend up to n items for a set of reference items using the default exclude set.
This implementation delegates to recommendRelatedItems(Set, int, Set, Set)
with default sets.
recommendRelatedItems
in interface ItemBasedItemRecommender
basket
- The reference items.n
- The number of recommendations to return (< 0 for unlimited).ItemBasedItemRecommender.recommendRelatedItems(Set, int, Set, Set)
public List<Long> recommendRelatedItems(Set<Long> basket)
Recommend all possible items for a set of reference items using the default exclude set.
This implementation delegates to recommendRelatedItems(Set, int)
with a length of -1.
recommendRelatedItems
in interface ItemBasedItemRecommender
basket
- The reference items.ItemBasedItemRecommender.recommendRelatedItems(Set, int, Set, Set)