|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mahout.cf.taste.impl.similarity.CachingUserSimilarity
public final class CachingUserSimilarity
Caches the results from an underlying UserSimilarity implementation.
| Constructor Summary | |
|---|---|
CachingUserSimilarity(UserSimilarity similarity,
DataModel dataModel)
Creates this on top of the given UserSimilarity. |
|
CachingUserSimilarity(UserSimilarity similarity,
int maxCacheSize)
Creates this on top of the given UserSimilarity. |
|
| Method Summary | |
|---|---|
void |
clearCacheForUser(long userID)
|
void |
refresh(Collection<Refreshable> alreadyRefreshed)
Triggers "refresh" -- whatever that means -- of the implementation. |
void |
setPreferenceInferrer(PreferenceInferrer inferrer)
Attaches a PreferenceInferrer to the UserSimilarity implementation. |
double |
userSimilarity(long userID1,
long userID2)
Returns the degree of similarity, of two users, based on the their preferences. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CachingUserSimilarity(UserSimilarity similarity,
DataModel dataModel)
throws TasteException
UserSimilarity.
The cache is sized according to properties of the given DataModel.
TasteException
public CachingUserSimilarity(UserSimilarity similarity,
int maxCacheSize)
UserSimilarity.
The cache size is capped by the given size.
| Method Detail |
|---|
public double userSimilarity(long userID1,
long userID2)
throws TasteException
UserSimilarityReturns the degree of similarity, of two users, based on the their preferences.
userSimilarity in interface UserSimilarityuserID1 - first user IDuserID2 - second user ID
Double.NaN similarity is unknown
NoSuchUserException - if either user is known to be non-existent in the data
TasteException - if an error occurs while accessing the datapublic void setPreferenceInferrer(PreferenceInferrer inferrer)
UserSimilarity
Attaches a PreferenceInferrer to the UserSimilarity implementation.
setPreferenceInferrer in interface UserSimilarityinferrer - PreferenceInferrerpublic void clearCacheForUser(long userID)
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.
refresh in interface RefreshablealreadyRefreshed - Refreshables 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||