Class GvmClusters<S extends GvmSpace,K>
- java.lang.Object
-
- org.hortonmachine.gears.utils.clustering.GvmClusters<S,K>
-
-
Constructor Summary
Constructors Constructor Description GvmClusters(S space, int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(double m, Object pt, K key)Adds a point to be clustered.voidclear()Removes all clusters and clustered points but retains the keyer.intgetCapacity()The greatest number of clusters that may be recorded.GvmKeyer<K>getKeyer()The keyer used to assign keys to clusters.SgetSpace()The space in which clustering will be performedvoidreduce(double maxVar, int minClusters)Collapses the number of clusters subject to constraints on the maximum permitted variance, and the least number of clusters.List<GvmResult<K>>results()Obtains the clusters for the points added.voidsetKeyer(GvmKeyer<K> keyer)The keyer to be used.
-
-
-
Constructor Detail
-
GvmClusters
public GvmClusters(S space, int capacity)
-
-
Method Detail
-
setKeyer
public void setKeyer(GvmKeyer<K> keyer)
The keyer to be used.- Parameters:
keyer- a keyer, not null
-
getCapacity
public int getCapacity()
The greatest number of clusters that may be recorded.- Returns:
- the capacity
-
getSpace
public S getSpace()
The space in which clustering will be performed- Returns:
- the space containing the points to be clustered
-
clear
public void clear()
Removes all clusters and clustered points but retains the keyer.
-
add
public void add(double m, Object pt, K key)Adds a point to be clustered.- Parameters:
m- the mass at the pointxs- the coordinates of the pointkey- a key assigned to the point, may be null
-
reduce
public void reduce(double maxVar, int minClusters)Collapses the number of clusters subject to constraints on the maximum permitted variance, and the least number of clusters. This method may be called at any time, including between calls to add().- Parameters:
maxVar- an upper bound on the global variance that may not be exceeded by merging clustersminClusters- a lower bound on the the number of clusters that may not be exceeded by merging clusters
-
-