public class Cluster
extends java.lang.Object
Cluster is a class that encapsulates a set of similar N-dimensional vector data. It has methods to add and get data vectors, as well as query the cluster index and number of elements.
Constructor and Description |
---|
Cluster(int clusterIndex)
The Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addVector(KDDMatrix vector)
Add a new N-dimensional vector to the Cluster.
|
void |
clearData()
This method removes all data from this cluster.
|
boolean |
contains(KDDMatrix data)
This method checks that this data vector is contained in this Cluster.
|
int |
getClusterIndex()
Return the Cluster index.
|
KDDMatrix |
getClusterMean(int nRows)
Return the center of mass vector for this Cluster.
|
java.util.ArrayList<KDDMatrix> |
getDataElements()
Return the vectors in this cluster.
|
KDDMatrix |
getRandomClusterMean(int nRows,
java.lang.Double min,
java.lang.Double max)
Return a random center of mass, where each element in the N-dimensional
vector must be within the range [min,max].
|
KDDMatrix |
getVector(int index)
Return the N-dimensional vector at the given index.
|
boolean |
isEmpty()
Returns whether or not this Cluster contains any data elements.
|
int |
numberOfElements()
Return the number of data elements in this Cluster.
|
public Cluster(int clusterIndex)
The Constructor
clusterIndex
- public KDDMatrix getVector(int index)
Return the N-dimensional vector at the given index.
index
- public void addVector(KDDMatrix vector)
Add a new N-dimensional vector to the Cluster.
vector
- public int numberOfElements()
Return the number of data elements in this Cluster.
public int getClusterIndex()
Return the Cluster index.
public KDDMatrix getClusterMean(int nRows)
Return the center of mass vector for this Cluster.
nRows
- public KDDMatrix getRandomClusterMean(int nRows, java.lang.Double min, java.lang.Double max)
Return a random center of mass, where each element in the N-dimensional vector must be within the range [min,max].
nRows
- min
- max
- public void clearData()
This method removes all data from this cluster.
public boolean contains(KDDMatrix data)
This method checks that this data vector is contained in this Cluster.
data
- public boolean isEmpty()
Returns whether or not this Cluster contains any data elements.
public java.util.ArrayList<KDDMatrix> getDataElements()
Return the vectors in this cluster.