|
|||||||||
| 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.TreeClusteringRecommender
public final class TreeClusteringRecommender
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:
Users in a cluster, recommendations will be the sameestimatePreference(Object, Object) 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.
| Constructor Summary | |
|---|---|
TreeClusteringRecommender(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
double clusteringThreshold)
|
|
TreeClusteringRecommender(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
double clusteringThreshold,
double samplingPercentage)
|
|
TreeClusteringRecommender(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
int numClusters)
|
|
TreeClusteringRecommender(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
int numClusters,
double samplingPercentage)
|
|
| Method Summary | |
|---|---|
double |
estimatePreference(java.lang.Object userID,
java.lang.Object itemID)
|
java.util.Collection<User> |
getCluster(java.lang.Object userID)
Returns the cluster of users to which the given |
java.util.Collection<java.util.Collection<User>> |
getClusters()
Returns all clusters of users. |
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 |
java.lang.String |
toString()
|
| Methods inherited from class com.planetj.taste.impl.recommender.AbstractRecommender |
|---|
getAllOtherItems, getDataModel, recommend, removePreference, setPreference |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.planetj.taste.recommender.Recommender |
|---|
getDataModel, recommend, removePreference, setPreference |
| Constructor Detail |
|---|
public TreeClusteringRecommender(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
int numClusters)
dataModel - DataModel which provdes UsersclusterSimilarity - ClusterSimilarity used to compute cluster similaritynumClusters - desired number of clusters to create
java.lang.IllegalArgumentException - if arguments are null, or numClusters is
less than 2
public TreeClusteringRecommender(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
int numClusters,
double samplingPercentage)
dataModel - DataModel which provdes UsersclusterSimilarity - ClusterSimilarity used to compute cluster similaritynumClusters - desired number of clusters to createsamplingPercentage - percentage of all cluster-cluster pairs to consider when finding
next-most-similar clusters. Decreasing this value from 1.0 can increase performance at the
cost of accuracy
java.lang.IllegalArgumentException - if arguments are null, or numClusters is
less than 2, or samplingPercentage is Double.NaN or nonpositive or greater than 1.0
public TreeClusteringRecommender(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
double clusteringThreshold)
dataModel - DataModel which provdes 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
java.lang.IllegalArgumentException - if arguments are null, or clusteringThreshold is
Double.NaN
public TreeClusteringRecommender(DataModel dataModel,
ClusterSimilarity clusterSimilarity,
double clusteringThreshold,
double samplingPercentage)
dataModel - DataModel which provdes 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 thresholdsamplingPercentage - percentage of all cluster-cluster pairs to consider when finding
next-most-similar clusters. Decreasing this value from 1.0 can increase performance at the
cost of accuracy
java.lang.IllegalArgumentException - if arguments are null, or clusteringThreshold is
Double.NaN, or samplingPercentage is Double.NaN or nonpositive or greater than 1.0| Method Detail |
|---|
@NotNull
public java.util.List<RecommendedItem> recommend(java.lang.Object userID,
int howMany,
Rescorer<Item> 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 double estimatePreference(java.lang.Object userID,
java.lang.Object 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
@NotNull
public java.util.Collection<User> getCluster(java.lang.Object userID)
throws TasteException
Returns 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
Collection of Users in the requested user's cluster
TasteException - if an error occurs while accessing the DataModel
@NotNull
public java.util.Collection<java.util.Collection<User>> getClusters()
throws TasteException
Returns all clusters of users.
getClusters in interface ClusteringRecommenderCollection of Collections of Users
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 | ||||||||