medusa.georgios.ClusteringAlgorithms
Class KMeansPoint
- java.lang.Object
-
- medusa.georgios.ClusteringAlgorithms.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[] coordinates)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 belongsdoublegetCoordinate(int i)double[]getCoordinates()java.lang.StringgetLabel()doublegetX()Returns the value of data point in x dimensiondoublegetY()Returns the value of data point in y dimensionstatic voidmain(java.lang.String[] args)Main method -- to test the kMeansPoint classvoidsetCoordinates(double[] coordinates)intsize()java.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[] coordinates)
-
-
Method Detail
-
getCoordinates
public double[] getCoordinates()
-
getCoordinate
public double getCoordinate(int i)
-
size
public int size()
-
setCoordinates
public void setCoordinates(double[] coordinates)
-
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
-
getX
public double getX()
Returns the value of data point in x dimension- Returns:
- the value in x dimension
-
getY
public double getY()
Returns the value of data point in y dimension- Returns:
- the value in y dimension
-
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