org.apache.mahout.cf.taste.recommender
Interface Recommender

All Superinterfaces:
Refreshable
All Known Subinterfaces:
ItemBasedRecommender, UserBasedRecommender
All Known Implementing Classes:
AbstractRecommender, CachingRecommender, GenericBooleanPrefItemBasedRecommender, GenericBooleanPrefUserBasedRecommender, GenericItemBasedRecommender, GenericUserBasedRecommender, ItemAverageRecommender, ItemUserAverageRecommender, RandomRecommender, SVDRecommender

public interface Recommender
extends Refreshable

Implementations of this interface can recommend items for a user. Implementations will likely take advantage of several classes in other packages here to compute this.


Method Summary
 float estimatePreference(long userID, long itemID)
           
 DataModel getDataModel()
           
 List<RecommendedItem> recommend(long userID, int howMany)
           
 List<RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer)
           
 void removePreference(long userID, long itemID)
           
 void setPreference(long userID, long itemID, float value)
           
 
Methods inherited from interface org.apache.mahout.cf.taste.common.Refreshable
refresh
 

Method Detail

recommend

List<RecommendedItem> recommend(long userID,
                                int howMany)
                                throws TasteException
Parameters:
userID - user for which recommendations are to be computed
howMany - desired number of recommendations
Returns:
List of recommended RecommendedItems, ordered from most strongly recommend to least
Throws:
TasteException - if an error occurs while accessing the DataModel

recommend

List<RecommendedItem> recommend(long userID,
                                int howMany,
                                IDRescorer rescorer)
                                throws TasteException
Parameters:
userID - user for which recommendations are to be computed
howMany - desired number of recommendations
rescorer - rescoring function to apply before final list of recommendations is determined
Returns:
List of recommended RecommendedItems, ordered from most strongly recommend to least
Throws:
TasteException - if an error occurs while accessing the DataModel

estimatePreference

float estimatePreference(long userID,
                         long itemID)
                         throws TasteException
Parameters:
userID - user ID whose preference is to be estimated
itemID - item ID to estimate preference for
Returns:
an estimated preference if the user has not expressed a preference for the item, or else the user's actual preference for the item. If a preference cannot be estimated, returns Double.NaN
Throws:
TasteException - if an error occurs while accessing the DataModel

setPreference

void setPreference(long userID,
                   long itemID,
                   float value)
                   throws TasteException
Parameters:
userID - user to set preference for
itemID - item to set preference for
value - preference value
Throws:
TasteException - if an error occurs while accessing the DataModel

removePreference

void removePreference(long userID,
                      long itemID)
                      throws TasteException
Parameters:
userID - user from which to remove preference
itemID - item for which to remove preference
Throws:
TasteException - if an error occurs while accessing the DataModel

getDataModel

DataModel getDataModel()
Returns:
underlying DataModel used by this Recommender implementation


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.