public class CentroidCluster<T extends DoubleVector> extends Object implements Cluster<T>
Cluster represents only the centroid of the data points assigned
to it. Assignments from data point indices to cluster ids are maintained
internally, but the actualy data points are discareded.| Constructor and Description |
|---|
CentroidCluster(T emptyVector)
|
| Modifier and Type | Method and Description |
|---|---|
void |
addVector(T vector,
int id)
|
T |
centroid()
Returns an immutable view of the centroid for this
Cluster. |
double |
compareWithVector(T vector)
Returns the similarity between this
Cluster and vector. |
BitSet |
dataPointIds()
Returns the set of identifiers for all data points assigned to this
cluster.
|
List<T> |
dataPointValues()
Returns an empty list, as no spare data point values are maintained.
|
void |
merge(Cluster<T> other)
|
int |
size()
Returns the total number of points assigned to this
Cluster. |
public CentroidCluster(T emptyVector)
CentroidCluster that takes ownership of emptyVector as the centroid for this Cluster. emptyVector should have length equal to the length of vectors that will
be assigned to this Cluster and should be dense if a large number
of vectors, or any dense vectors, are expected to be assigned to this
Cluster.public void addVector(T vector, int id)
addVector in interface Cluster<T extends DoubleVector>public double compareWithVector(T vector)
Cluster and vector.compareWithVector in interface Cluster<T extends DoubleVector>public T centroid()
Cluster.centroid in interface Cluster<T extends DoubleVector>public List<T> dataPointValues()
dataPointValues in interface Cluster<T extends DoubleVector>public BitSet dataPointIds()
dataPointIds in interface Cluster<T extends DoubleVector>public void merge(Cluster<T> other)
other Cluster with this Cluster.
This Cluster will absorb all data points from other and
update the centroid and data point assignments as needed.merge in interface Cluster<T extends DoubleVector>public int size()
Cluster.size in interface Cluster<T extends DoubleVector>Copyright © 2012. All Rights Reserved.