comirva.audio.util.kmeans
Class KMeansClustering.Cluster

java.lang.Object
  extended by comirva.audio.util.kmeans.KMeansClustering.Cluster
Enclosing class:
KMeansClustering

protected class KMeansClustering.Cluster
extends Object

A set of homogen points in the n-dimensional space is represented by a Cluster object.


Field Summary
protected  Matrix center
           
protected  int N
           
 
Constructor Summary
KMeansClustering.Cluster(Matrix mean)
          Constructs a new cluster.
 
Method Summary
 void add(Matrix x)
          Adds a point x to this cluster.
 Matrix getCenter()
          Returns the cluster center.
 double getDistanceFromCenter(Matrix x)
          Returns the euclidian distance of a point x to the cluster center.
 Matrix getMeanOfElements()
          Returns the mean of all the elements in this cluster.
 int getNumberOfElements()
          Returns the number of elements in this cluster.
 Matrix getVarianceOfElements()
          Returns the variance of all the elements in this cluster.
 void print()
          Prints some information about this cluster.
 void reset(Matrix newCenter)
          Resets all internal values of this cluster.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

N

protected int N

center

protected Matrix center
Constructor Detail

KMeansClustering.Cluster

public KMeansClustering.Cluster(Matrix mean)
Constructs a new cluster.

Parameters:
mean - Matrix the cluster center of this new cluster.
Method Detail

getDistanceFromCenter

public double getDistanceFromCenter(Matrix x)
Returns the euclidian distance of a point x to the cluster center.

Parameters:
x - Matrix point in the n-dimensional space
Returns:
double distance to the cluster center

add

public void add(Matrix x)
Adds a point x to this cluster.

Parameters:
x - Matrix o point in the n-dimensional space

getMeanOfElements

public Matrix getMeanOfElements()
Returns the mean of all the elements in this cluster.

Returns:
Matrix mean of the elements in this cluster

getVarianceOfElements

public Matrix getVarianceOfElements()
Returns the variance of all the elements in this cluster.

Returns:
Matrix variance of the elements in this cluster

reset

public void reset(Matrix newCenter)
Resets all internal values of this cluster. Additionally the cluster center is set to the given value.

Parameters:
newCenter - Matrix

getNumberOfElements

public int getNumberOfElements()
Returns the number of elements in this cluster.

Returns:
int number of elements in this cluster

getCenter

public Matrix getCenter()
Returns the cluster center.

Returns:
Matrix the cluster center

print

public void print()
Prints some information about this cluster. This is for debugging purpose only.