public abstract class AbstractItemBasedItemRecommender extends java.lang.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 |
---|---|
java.util.List<java.lang.Long> |
recommendRelatedItems(long reference)
Recommend all possible items for a reference item using the default exclude set.
|
java.util.List<java.lang.Long> |
recommendRelatedItems(long reference,
int n)
Recommend up to n possible items for a reference item using the default exclude set.
|
java.util.List<java.lang.Long> |
recommendRelatedItems(java.util.Set<java.lang.Long> basket)
Recommend all possible items for a set of reference items using the default exclude set.
|
java.util.List<java.lang.Long> |
recommendRelatedItems(java.util.Set<java.lang.Long> basket,
int n)
Recommend up to n items for a set of reference items using the default exclude set.
|
java.util.List<java.lang.Long> |
recommendRelatedItems(java.util.Set<java.lang.Long> basket,
int n,
java.util.Set<java.lang.Long> candidates,
java.util.Set<java.lang.Long> exclude)
Produce a set of recommendations for the item.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
recommendRelatedItemsWithDetails
public java.util.List<java.lang.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. If negative, recommend as many as possible.ItemBasedItemRecommender.recommendRelatedItems(Set, int, Set, Set)
public java.util.List<java.lang.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 java.util.List<java.lang.Long> recommendRelatedItems(java.util.Set<java.lang.Long> basket, int n, @Nullable java.util.Set<java.lang.Long> candidates, @Nullable java.util.Set<java.lang.Long> exclude)
Produce a set of recommendations for the item. This is the most general recommendation method, allowing the recommendations to be constrained by both a candidate set \(\mathcal{C}\) and an exclude set \(\mathcal{E}\). The exclude set is applied to the candidate set, so the final effective candidate set is \(\mathcal{C} \backslash \mathcal{E}\).
The recommender is not guaranteed to return a full n
recommendations. There are many reasons why it might return a shorter list, including lack of items, lack of coverage for items, or a predefined notion of a maximum recommendation list length. However, a negative value for n
instructs the recommender to return as many as it can consistent with any limitations built in to its design and/or supporting algorithms.
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, recommend as many as possible.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 java.util.List<java.lang.Long> recommendRelatedItems(java.util.Set<java.lang.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. If negative, recommend as many as possible.ItemBasedItemRecommender.recommendRelatedItems(Set, int, Set, Set)
public java.util.List<java.lang.Long> recommendRelatedItems(java.util.Set<java.lang.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)