|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.cf.taste.impl.recommender.AbstractRecommender
org.apache.mahout.cf.taste.impl.recommender.ItemAverageRecommender
public final class ItemAverageRecommender
A simple recommender that always estimates preference for an item to be the average of all known preference values for that item. No information about users is taken into account. This implementation is provided for experimentation; while simple and fast, it may not produce very good recommendations.
Constructor Summary | |
---|---|
ItemAverageRecommender(DataModel dataModel)
|
Method Summary | |
---|---|
float |
estimatePreference(long userID,
long itemID)
|
List<RecommendedItem> |
recommend(long userID,
int howMany,
IDRescorer rescorer)
|
void |
refresh(Collection<Refreshable> alreadyRefreshed)
Triggers "refresh" -- whatever that means -- of the implementation. |
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) . |
String |
toString()
|
Methods inherited from class org.apache.mahout.cf.taste.impl.recommender.AbstractRecommender |
---|
getAllOtherItems, getDataModel, getDefaultCandidateItemsStrategy, recommend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ItemAverageRecommender(DataModel dataModel) throws TasteException
TasteException
Method Detail |
---|
public List<RecommendedItem> recommend(long userID, int howMany, IDRescorer rescorer) throws TasteException
userID
- user for which recommendations are to be computedhowMany
- desired number of recommendationsrescorer
- rescoring function to apply before final list of recommendations is determined
List
of recommended RecommendedItem
s, ordered from most strongly recommend to
least
TasteException
- if an error occurs while accessing the DataModel
public float estimatePreference(long userID, long itemID) throws TasteException
userID
- user ID whose preference is to be estimateditemID
- item ID to estimate preference for
Double.NaN
TasteException
- if an error occurs while accessing the DataModel
public void setPreference(long userID, long itemID, float value) throws TasteException
AbstractRecommender
Default implementation which just calls DataModel.setPreference(long, long, float)
.
setPreference
in interface Recommender
setPreference
in class AbstractRecommender
userID
- user to set preference foritemID
- item to set preference forvalue
- preference value
TasteException
- if an error occurs while accessing the DataModel
public void removePreference(long userID, long itemID) throws TasteException
AbstractRecommender
Default implementation which just calls DataModel.removePreference(long, long)
(Object, Object)}.
removePreference
in interface Recommender
removePreference
in class AbstractRecommender
userID
- user from which to remove preferenceitemID
- item for which to remove preference
TasteException
- if an error occurs while accessing the DataModel
public void refresh(Collection<Refreshable> alreadyRefreshed)
Refreshable
Triggers "refresh" -- whatever that means -- of the implementation. The general contract is that any
Refreshable
should always leave itself in a consistent, operational state, and that the refresh
atomically updates internal state from old to new.
alreadyRefreshed
- Refreshable
s that are known to have already been
refreshed as a result of an initial call to a Refreshable.refresh(Collection)
method on some
object. This ensure that objects in a refresh dependency graph aren't refreshed twice
needlessly.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |