|
||||||||||
| 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.TreeClusteringRecommender2
public final class TreeClusteringRecommender2
A Recommender that clusters users, then determines the
clusters' top recommendations. This implementation builds clusters by repeatedly merging clusters until
only a certain number remain, meaning that each cluster is sort of a tree of other clusters.
This Recommender therefore has a few properties to note:
estimatePreference(long, long) may well return Double.NaN; it does so when asked to
estimate preference for an item for which no preference is expressed in the users in the cluster.
This is an experimental implementation which tries to gain a lot of speed at the cost of accuracy
in building clusters, compared to TreeClusteringRecommender. It will sometimes cluster two other
clusters together that may not be the exact closest two clusters in existence. This may not affect the
recommendation quality much, but it potentially speeds up the clustering process dramatically.
| Constructor Summary | |
|---|---|
TreeClusteringRecommender2(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
double clusteringThreshold)
|
|
TreeClusteringRecommender2(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
int numClusters)
|
|
| Method Summary | |
|---|---|
float |
estimatePreference(long userID,
long itemID)
|
FastIDSet |
getCluster(long userID)
Returns the cluster of users to which the given user, denoted by user ID, belongs. |
FastIDSet[] |
getClusters()
Returns all clusters of users. |
List<RecommendedItem> |
recommend(long userID,
int howMany,
IDRescorer rescorer)
|
void |
refresh(Collection<Refreshable> alreadyRefreshed)
Triggers "refresh" -- whatever that means -- of the implementation. |
String |
toString()
|
| Methods inherited from class org.apache.mahout.cf.taste.impl.recommender.AbstractRecommender |
|---|
getAllOtherItems, getDataModel, getDefaultCandidateItemsStrategy, recommend, removePreference, setPreference |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.mahout.cf.taste.recommender.Recommender |
|---|
getDataModel, recommend, removePreference, setPreference |
| Constructor Detail |
|---|
public TreeClusteringRecommender2(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
int numClusters)
throws TasteException
dataModel - DataModel which provides usersclusterSimilarity - ClusterSimilarity used to compute cluster similaritynumClusters - desired number of clusters to create
IllegalArgumentException - if arguments are null, or numClusters is less than 2
TasteException
public TreeClusteringRecommender2(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
double clusteringThreshold)
throws TasteException
dataModel - DataModel which provides usersclusterSimilarity - ClusterSimilarity used to compute cluster
similarityclusteringThreshold - clustering similarity threshold; clusters will be aggregated into larger clusters until the next
two nearest clusters' similarity drops below this threshold
IllegalArgumentException - if arguments are null, or clusteringThreshold is Double.NaN
TasteException| Method Detail |
|---|
public 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 determined
List of recommended RecommendedItems, 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
estimatePreference in interface RecommenderuserID - 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 FastIDSet getCluster(long userID)
throws TasteException
ClusteringRecommenderReturns the cluster of users to which the given user, denoted by user ID, belongs.
getCluster in interface ClusteringRecommenderuserID - user ID for which to find a cluster
FastIDSet of IDs of users in the requested user's cluster
TasteException - if an error occurs while accessing the DataModel
public FastIDSet[] getClusters()
throws TasteException
ClusteringRecommenderReturns all clusters of users.
getClusters in interface ClusteringRecommenderFastIDSets of user IDs
TasteException - if an error occurs while accessing the DataModelpublic void refresh(Collection<Refreshable> alreadyRefreshed)
RefreshableTriggers "refresh" -- whatever that means -- of the implementation. The general contract is that any 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 - s that are known to have already been
refreshed as a result of an initial call to a 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 | |||||||||