netflix.algorithms.memorybased.rectree
Class ClusterCollection
java.lang.Object
netflix.algorithms.memorybased.rectree.ClusterCollection
- All Implemented Interfaces:
- cern.colt.function.IntIntProcedure
public class ClusterCollection
- extends java.lang.Object
- implements cern.colt.function.IntIntProcedure
Class to convert a hashtable from uid to cluster
to an array of IntArrayLists representing each
cluster. We make this a separate class so that
it can be used with the forEachPair method in the
OpenIntIntHashMap class in the colt package.
Cerns code to iterate through a hashtable is
almost certainly faster than mine would be.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClusterCollection
public ClusterCollection(int k,
MemHelper helper)
- Parameters:
k - Number of clusters.
ClusterCollection
public ClusterCollection(java.util.ArrayList<cern.colt.list.IntArrayList> clusters,
MemHelper helper)
getClusters
public java.util.ArrayList<cern.colt.list.IntArrayList> getClusters()
getCluster
public cern.colt.list.IntArrayList getCluster(int cluster)
getAverage
public double getAverage(int cluster)
size
public int size()
getClusterSize
public int getClusterSize(int cluster)
apply
public boolean apply(int first,
int second)
- Adds user first to cluster second.
- Specified by:
apply in interface cern.colt.function.IntIntProcedure
- Returns:
- true (not used).
printClusters
public void printClusters()