|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.planetj.taste.impl.recommender.AbstractRecommender
com.planetj.taste.impl.recommender.slopeone.SlopeOneRecommender
public final class SlopeOneRecommender
A basic "slope one" recommender. (See an
excellent summary here for example.) This Recommender is especially
suitable when user preferences are updating frequently as it can incorporate this information without
expensive recomputation.
This implementation can also be used as a "weighted slope one" recommender.
| Constructor Summary | |
|---|---|
SlopeOneRecommender(DataModel dataModel)
Creates a default (weighted) SlopeOneRecommender based on the given DataModel. |
|
SlopeOneRecommender(DataModel dataModel,
boolean weighted,
boolean stdDevWeighted,
DiffStorage diffStorage)
Creates a SlopeOneRecommender based on the given DataModel. |
|
| Method Summary | |
|---|---|
double |
estimatePreference(java.lang.Object userID,
java.lang.Object itemID)
|
java.util.List<RecommendedItem> |
recommend(java.lang.Object userID,
int howMany,
Rescorer<Item> rescorer)
|
void |
refresh()
Triggers "refresh" -- whatever that means -- of the implementation. The general contract is that
any |
void |
removePreference(java.lang.Object userID,
java.lang.Object itemID)
Default implementation which just calls
|
void |
setPreference(java.lang.Object userID,
java.lang.Object itemID,
double value)
Default implementation which just calls |
java.lang.String |
toString()
|
| Methods inherited from class com.planetj.taste.impl.recommender.AbstractRecommender |
|---|
getAllOtherItems, getDataModel, recommend |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SlopeOneRecommender(DataModel dataModel)
throws TasteException
Creates a default (weighted) SlopeOneRecommender based on the given DataModel.
dataModel - data model
TasteException
public SlopeOneRecommender(DataModel dataModel,
boolean weighted,
boolean stdDevWeighted,
DiffStorage diffStorage)
Creates a SlopeOneRecommender based on the given DataModel.
If weighted is set, acts as a weighted slope one recommender.
This implementation also includes an experimental "standard deviation" weighting which weights
item-item ratings diffs with lower standard deviation more highly, on the theory that they are more
reliable.
dataModel - weighted - if true, acts as a weighted slope one recommenderstdDevWeighted - use optional standard deviation weighting of diffs
java.lang.IllegalArgumentException - if diffStorage is null, or stdDevWeighted is set
when weighted is not set| Method Detail |
|---|
@NotNull
public java.util.List<RecommendedItem> recommend(java.lang.Object userID,
int howMany,
Rescorer<Item> 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 RecommendedItems, ordered from most strongly
recommend to least
TasteException - if an error occurs while accessing the DataModel
public double estimatePreference(java.lang.Object userID,
java.lang.Object 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(java.lang.Object userID,
java.lang.Object itemID,
double value)
throws TasteException
Default implementation which just calls DataModel.setPreference(Object, Object, double).
setPreference in interface RecommendersetPreference in class AbstractRecommenderuserID - user to set preference foritemID - item to set preference forvalue - preference value
TasteException - if an error occurs while accessing the DataModel
public void removePreference(java.lang.Object userID,
java.lang.Object itemID)
throws TasteException
Default implementation which just calls
DataModel.removePreference(Object, Object) (Object, Object)}.
removePreference in interface RecommenderremovePreference in class AbstractRecommenderuserID - user from which to remove preferenceitemID - item for which to remove preference
TasteException - if an error occurs while accessing the DataModelpublic void refresh()
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.
refresh in interface Refreshablerefresh in class AbstractRecommender@NotNull public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||