|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface MyrrixRecommender
Defines additional methods supported beyond what is in ItemBasedRecommender,
including a method to recommend to "anonymous" users recommendToAnonymous(long[], int)
and a means to bulk-load data ingest(Reader).
Note that the API methods setPreference(long, long)
and removePreference(long, long), retained from Apache Mahout, have a somewhat different meaning
than in Mahout. They add to an association strength, rather than replace it. See the javadoc.
| Method Summary | |
|---|---|
void |
await()
Blocks until isReady() returns true. |
float[] |
estimatePreferences(long userID,
long... itemIDs)
A bulk version of Recommender.estimatePreference(long, long), suitable for computing many estimates
at once. |
org.apache.mahout.cf.taste.impl.common.FastIDSet |
getAllItemIDs()
|
org.apache.mahout.cf.taste.impl.common.FastIDSet |
getAllUserIDs()
|
void |
ingest(File file)
"Uploads" a series of new associations to the recommender; this is like a bulk version of setPreference(long, long, float). |
void |
ingest(Reader reader)
Like ingest(File), but reads from a Reader. |
boolean |
isReady()
|
List<org.apache.mahout.cf.taste.recommender.RecommendedItem> |
recommend(long userID,
int howMany,
boolean considerKnownItems,
org.apache.mahout.cf.taste.recommender.IDRescorer rescorer)
|
List<org.apache.mahout.cf.taste.recommender.RecommendedItem> |
recommendToAnonymous(long[] itemIDs,
int howMany)
Computes recommendations for a user that is not known to the model yet; instead, the user's associated items are supplied to the method and it proceeds as if a user with these associated items were in the model. |
List<org.apache.mahout.cf.taste.recommender.RecommendedItem> |
recommendToMany(long[] userIDs,
int howMany,
boolean considerKnownItems,
org.apache.mahout.cf.taste.recommender.IDRescorer rescorer)
Recommends to a group of users all at once. |
void |
removePreference(long userID,
long itemID)
This method will remove an item from the user's set of known items, making it eligible for recommendation again. |
void |
setPreference(long userID,
long itemID)
Defaults to value 1.0. |
void |
setPreference(long userID,
long itemID,
float value)
Adds to a user-item preference, or association. |
| Methods inherited from interface org.apache.mahout.cf.taste.recommender.ItemBasedRecommender |
|---|
mostSimilarItems, mostSimilarItems, mostSimilarItems, mostSimilarItems, mostSimilarItems, mostSimilarItems, recommendedBecause |
| Methods inherited from interface org.apache.mahout.cf.taste.recommender.Recommender |
|---|
estimatePreference, getDataModel, recommend, recommend |
| Methods inherited from interface org.apache.mahout.cf.taste.common.Refreshable |
|---|
refresh |
| Method Detail |
|---|
List<org.apache.mahout.cf.taste.recommender.RecommendedItem> recommend(long userID,
int howMany,
boolean considerKnownItems,
org.apache.mahout.cf.taste.recommender.IDRescorer rescorer)
throws org.apache.mahout.cf.taste.common.TasteException
userID - user for which recommendations are to be computedhowMany - desired number of recommendationsconsiderKnownItems - if true, items that the user is already associated to are candidates
for recommendation. Normally this is false.rescorer - rescoring function used to modify association strengths before ranking results
List of recommended RecommendedItems, ordered from most strongly recommend to least
NotReadyException - if the recommender has no model available yet
org.apache.mahout.cf.taste.common.TasteException - if another error occurs
List<org.apache.mahout.cf.taste.recommender.RecommendedItem> recommendToMany(long[] userIDs,
int howMany,
boolean considerKnownItems,
org.apache.mahout.cf.taste.recommender.IDRescorer rescorer)
throws org.apache.mahout.cf.taste.common.TasteException
recommend(long, int, boolean, IDRescorer).
org.apache.mahout.cf.taste.common.TasteException
List<org.apache.mahout.cf.taste.recommender.RecommendedItem> recommendToAnonymous(long[] itemIDs,
int howMany)
throws org.apache.mahout.cf.taste.common.TasteException
NotReadyException - if the implementation has no usable model yet
org.apache.mahout.cf.taste.common.TasteExceptionRecommender.recommend(long, int)
float[] estimatePreferences(long userID,
long... itemIDs)
throws org.apache.mahout.cf.taste.common.TasteException
Recommender.estimatePreference(long, long), suitable for computing many estimates
at once. The return values correspond, in order, to the item IDs provided, in order.
org.apache.mahout.cf.taste.common.TasteExceptionRecommender.estimatePreference(long, long)
void ingest(Reader reader)
throws org.apache.mahout.cf.taste.common.TasteException
ingest(File), but reads from a Reader.
reader - source of CSV data to ingest
NotReadyException - if the implementation has no usable model yet
org.apache.mahout.cf.taste.common.TasteException
void ingest(File file)
throws org.apache.mahout.cf.taste.common.TasteException
setPreference(long, long, float). The input file should be in CSV format, where each
line is of the form userID,itemID,value. Note that the file may be compressed. If it is
make sure that its name reflects its compression -- gzip ending in ".gz", zip ending in ".zip",
deflate ending in ".deflate".
file - CSV file to ingest, possibly compressed.
NotReadyException - if the implementation has no usable model yet
org.apache.mahout.cf.taste.common.TasteException
void setPreference(long userID,
long itemID)
throws org.apache.mahout.cf.taste.common.TasteException
org.apache.mahout.cf.taste.common.TasteException - if the preference cannot be updated, due to a server error
NotReadyException - if the implementation has no usable model yetsetPreference(long, long, float)
void setPreference(long userID,
long itemID,
float value)
throws org.apache.mahout.cf.taste.common.TasteException
Adds to a user-item preference, or association. This is called in response to some action that indicates the user has a stronger association to an item, like a click or purchase. It is intended to be called many times for a user and item, as more actions are observed that associate the two. That is, this calls adds to rather than sets the association.
To "undo" associations, call this method with negative values, or
see removePreference(long, long).
Value is not a rating, but a strength indicator. It may be negative. Its magnitude should correspond to the degree to which an observed event suggests an association between a user and item. A value twice as big should correspond to an event that suggests twice as strong an association.
For example, a click on a video might result in a call with value 1.0. Watching half of the video might result in another call adding value 3.0. Finishing the video, another 3.0. Liking or sharing the video, an additional 10.0. Clicking away from a video within 10 seconds might result in a -3.0.
setPreference in interface org.apache.mahout.cf.taste.recommender.RecommenderuserID - user involved in the new preferenceitemID - item involvedvalue - strength value
org.apache.mahout.cf.taste.common.TasteException - if the preference cannot be updated, due to a server error
NotReadyException - if the implementation has no usable model yet
void removePreference(long userID,
long itemID)
throws org.apache.mahout.cf.taste.common.TasteException
This method will remove an item from the user's set of known items,
making it eligible for recommendation again. If the user has no more items, this method will remove
the user too, such that new calls to Recommender.recommend(long, int) for example
will fail with NoSuchUserException.
It does not affect any user-item association strengths.
Contrast with calling setPreference(long, long, float) with a negative value,
which merely records a negative association between the user and item.
removePreference in interface org.apache.mahout.cf.taste.recommender.Recommenderorg.apache.mahout.cf.taste.common.TasteException
boolean isReady()
throws org.apache.mahout.cf.taste.common.TasteException
org.apache.mahout.cf.taste.common.TasteException
void await()
throws org.apache.mahout.cf.taste.common.TasteException
isReady() returns true.
org.apache.mahout.cf.taste.common.TasteException
org.apache.mahout.cf.taste.impl.common.FastIDSet getAllUserIDs()
throws org.apache.mahout.cf.taste.common.TasteException
org.apache.mahout.cf.taste.common.TasteException
org.apache.mahout.cf.taste.impl.common.FastIDSet getAllItemIDs()
throws org.apache.mahout.cf.taste.common.TasteException
org.apache.mahout.cf.taste.common.TasteException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||