public abstract class AbstractRecommender extends Object implements Recommender
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRecommender(DataModel dataModel) |
protected |
AbstractRecommender(DataModel dataModel,
CandidateItemsStrategy candidateItemsStrategy) |
| Modifier and Type | Method and Description |
|---|---|
protected FastIDSet |
getAllOtherItems(long userID,
PreferenceArray preferencesFromUser,
boolean includeKnownItems) |
DataModel |
getDataModel() |
protected static CandidateItemsStrategy |
getDefaultCandidateItemsStrategy() |
List<RecommendedItem> |
recommend(long userID,
int howMany)
Default implementation which just calls
Recommender.recommend(long, int, org.apache.mahout.cf.taste.recommender.IDRescorer), with a
Rescorer that does nothing. |
List<RecommendedItem> |
recommend(long userID,
int howMany,
boolean includeKnownItems)
Default implementation which just calls
Recommender.recommend(long, int, org.apache.mahout.cf.taste.recommender.IDRescorer), with a
Rescorer that does nothing. |
List<RecommendedItem> |
recommend(long userID,
int howMany,
IDRescorer rescorer)
|
void |
removePreference(long userID,
long itemID)
Default implementation which just calls
DataModel.removePreference(long, long) (Object, Object)}. |
void |
setPreference(long userID,
long itemID,
float value)
Default implementation which just calls
DataModel.setPreference(long, long, float). |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitestimatePreference, recommendrefreshprotected AbstractRecommender(DataModel dataModel, CandidateItemsStrategy candidateItemsStrategy)
protected AbstractRecommender(DataModel dataModel)
protected static CandidateItemsStrategy getDefaultCandidateItemsStrategy()
public List<RecommendedItem> recommend(long userID, int howMany) throws TasteException
Default implementation which just calls
Recommender.recommend(long, int, org.apache.mahout.cf.taste.recommender.IDRescorer), with a
Rescorer that does nothing.
recommend in interface RecommenderuserID - user for which recommendations are to be computedhowMany - desired number of recommendationsList of recommended RecommendedItems, ordered from most strongly recommend to
leastTasteException - if an error occurs while accessing the DataModelpublic List<RecommendedItem> recommend(long userID, int howMany, boolean includeKnownItems) throws TasteException
Default implementation which just calls
Recommender.recommend(long, int, org.apache.mahout.cf.taste.recommender.IDRescorer), with a
Rescorer that does nothing.
recommend in interface RecommenderuserID - user for which recommendations are to be computedhowMany - desired number of recommendationsincludeKnownItems - whether to include items already known by the user in recommendationsList of recommended RecommendedItems, ordered from most strongly recommend to
leastTasteException - if an error occurs while accessing the DataModelpublic List<RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer) throws TasteException
recommend in interface RecommenderuserID - user for which recommendations are to be computedhowMany - desired number of recommendationsrescorer - rescoring function to apply before final list of recommendations is determinedList of recommended RecommendedItems, ordered from most strongly recommend to
leastTasteException - if an error occurs while accessing the DataModelpublic void setPreference(long userID,
long itemID,
float value)
throws TasteException
Default implementation which just calls DataModel.setPreference(long, long, float).
setPreference in interface RecommenderuserID - user to set preference foritemID - item to set preference forvalue - preference valueIllegalArgumentException - if userID or itemID is null, or if value is Double.NaNTasteException - if an error occurs while accessing the DataModelpublic void removePreference(long userID,
long itemID)
throws TasteException
Default implementation which just calls DataModel.removePreference(long, long) (Object, Object)}.
removePreference in interface RecommenderuserID - user from which to remove preferenceitemID - item for which to remove preferenceIllegalArgumentException - if userID or itemID is nullTasteException - if an error occurs while accessing the DataModelpublic DataModel getDataModel()
getDataModel in interface RecommenderDataModel used by this Recommender implementationprotected FastIDSet getAllOtherItems(long userID, PreferenceArray preferencesFromUser, boolean includeKnownItems) throws TasteException
userID - ID of user being evaluatedpreferencesFromUser - the preferences from the userincludeKnownItems - whether to include items already known by the user in recommendationsDataModel for which the user has not expressed a preference and could
possibly be recommended to the userTasteException - if an error occurs while listing itemsCopyright © 2008–2017 The Apache Software Foundation. All rights reserved.