|
||||||||||
| 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.AbstractItemSimilarity
org.apache.mahout.cf.taste.impl.similarity.TanimotoCoefficientSimilarity
public final class TanimotoCoefficientSimilarity
An implementation of a "similarity" based on the Tanimoto coefficient, or extended Jaccard coefficient.
This is intended for "binary" data sets where a user either expresses a generic "yes" preference for an item or has no preference. The actual preference values do not matter here, only their presence or absence.
The value returned is in [0,1].
| Constructor Summary | |
|---|---|
TanimotoCoefficientSimilarity(DataModel dataModel)
|
|
| Method Summary | |
|---|---|
double[] |
itemSimilarities(long itemID1,
long[] itemID2s)
A bulk-get version of ItemSimilarity.itemSimilarity(long, long). |
double |
itemSimilarity(long itemID1,
long itemID2)
Returns the degree of similarity, of two items, based on the preferences that users have expressed for the items. |
void |
refresh(Collection<Refreshable> alreadyRefreshed)
Triggers "refresh" -- whatever that means -- of the implementation. |
void |
setPreferenceInferrer(PreferenceInferrer inferrer)
Attaches a PreferenceInferrer to the UserSimilarity implementation. |
String |
toString()
|
double |
userSimilarity(long userID1,
long userID2)
Returns the degree of similarity, of two users, based on the their preferences. |
| Methods inherited from class org.apache.mahout.cf.taste.impl.similarity.AbstractItemSimilarity |
|---|
allSimilarItemIDs, getDataModel |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public TanimotoCoefficientSimilarity(DataModel dataModel)
| Method Detail |
|---|
public void setPreferenceInferrer(PreferenceInferrer inferrer)
UserSimilarity
Attaches a PreferenceInferrer to the UserSimilarity implementation.
setPreferenceInferrer in interface UserSimilarityinferrer - PreferenceInferrer
UnsupportedOperationException
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 data
public double itemSimilarity(long itemID1,
long itemID2)
throws TasteException
ItemSimilarityReturns the degree of similarity, of two items, based on the preferences that users have expressed for the items.
itemSimilarity in interface ItemSimilarityitemID1 - first item IDitemID2 - second item ID
Double.NaN similarity is unknown
NoSuchItemException - if either item is known to be non-existent in the data
TasteException - if an error occurs while accessing the data
public double[] itemSimilarities(long itemID1,
long[] itemID2s)
throws TasteException
ItemSimilarityA bulk-get version of ItemSimilarity.itemSimilarity(long, long).
itemSimilarities in interface ItemSimilarityitemID1 - first item IDitemID2s - second item IDs to compute similarity with
NoSuchItemException - if any item is known to be non-existent in the data
TasteException - if an error occurs while accessing the datapublic 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 Refreshablerefresh in class AbstractItemSimilarityalreadyRefreshed - 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.public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||