ac.essex.ooechs.kmeans
Class Position

java.lang.Object
  extended by ac.essex.ooechs.kmeans.Position

public class Position
extends java.lang.Object

Represents a position in n dimensional feature space.


Field Summary
protected  double[] values
          The position is stored as an array of double values.
 
Constructor Summary
Position(double[] values)
          Initialises the position with an array of double values, each of which represents the value of one feature.
 
Method Summary
 Position copy()
          Makes a copy of this position so that it can be used somewhere else without updating this object's position by accident.
 double getEuclideanDistanceTo(Position other)
          Finds the Euclidian distance from this position to another position which is the root sum of squared differences.
 java.lang.String toString()
           
 void updateToAverageOf(java.util.Vector<DataPoint> objects)
          Finds the average position among a set of points' positions and then updates the current position to the average position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

values

protected double[] values
The position is stored as an array of double values.

Constructor Detail

Position

public Position(double[] values)
Initialises the position with an array of double values, each of which represents the value of one feature.

Method Detail

getEuclideanDistanceTo

public double getEuclideanDistanceTo(Position other)
Finds the Euclidian distance from this position to another position which is the root sum of squared differences.


updateToAverageOf

public void updateToAverageOf(java.util.Vector<DataPoint> objects)
Finds the average position among a set of points' positions and then updates the current position to the average position.


copy

public Position copy()
Makes a copy of this position so that it can be used somewhere else without updating this object's position by accident.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object