medusa.spectral
Class KMeansPoint
- java.lang.Object
-
- medusa.spectral.KMeansPoint
-
public class KMeansPoint extends java.lang.ObjectRepresents an abstraction for a data point in two dimensional space
-
-
Constructor Summary
Constructors Constructor and Description KMeansPoint(java.lang.String label, double[] coords)KMeansPoint(java.lang.String label, double _x, double _y)Creates a new instance of data point
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidassignToCluster(int _clusterNumber)Assigns the data point to a clusterstatic doubledistance(KMeansPoint dp1, KMeansPoint dp2)Returns the distance between two data pointsintgetClusterNumber()Returns the cluster to which the data point belongsdouble[]getCoords()intgetDimensions()java.lang.StringgetLabel()static voidmain(java.lang.String[] args)Main method -- to test the kMeansPoint classjava.lang.StringtoDataString()java.lang.StringtoString()Returns a string representation of this kMeansPoint
-
-
-
Constructor Detail
-
KMeansPoint
public KMeansPoint(java.lang.String label, double _x, double _y)Creates a new instance of data point- Parameters:
_x- value in dimension x_y- value in dimension y
-
KMeansPoint
public KMeansPoint(java.lang.String label, double[] coords)
-
-
Method Detail
-
getDimensions
public int getDimensions()
-
assignToCluster
public void assignToCluster(int _clusterNumber)
Assigns the data point to a cluster- Parameters:
_clusterNumber- the cluster to which this data point is to be assigned
-
getClusterNumber
public int getClusterNumber()
Returns the cluster to which the data point belongs- Returns:
- the cluster number to which the data point belongs
-
getCoords
public double[] getCoords()
-
distance
public static double distance(KMeansPoint dp1, KMeansPoint dp2)
Returns the distance between two data points- Parameters:
dp1- the first data pointdp2- the second data point- Returns:
- the distance between the two data points
-
toString
public java.lang.String toString()
Returns a string representation of this kMeansPoint- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this data point
-
toDataString
public java.lang.String toDataString()
-
main
public static void main(java.lang.String[] args)
Main method -- to test the kMeansPoint class- Parameters:
args- command line arguments
-
getLabel
public java.lang.String getLabel()
-
-
DMelt 3.0 © DataMelt by jWork.ORG