public class DataPoint extends Object implements Serializable
| Constructor and Description |
|---|
DataPoint(double[] xx)
Creates a new instance of a data point
|
DataPoint(double[] xx,
int dim)
Creates a new instance of a data point
|
| Modifier and Type | Method and Description |
|---|---|
void |
assignToCluster(int _clusterNumber)
Assigns the data point to a cluster
|
static double |
distance(DataPoint dp1,
DataPoint dp2)
Returns the distance between two data points
|
static double |
distanceSqrt(DataPoint dp1,
DataPoint dp2)
Returns the squared distance between two data points
|
double |
getAttribute(int index)
Returns the attribute of data point
|
int |
getClusterNumber()
Returns the cluster to which the data point belongs
|
int |
getDimension()
Get dimension of the point
|
static void |
main(String[] args)
Main method -- to test the DataPoint class
|
void |
showAttributes()
Print all attributes of a data point
|
String |
toString()
Returns a string representation of this DataPoint
|
public DataPoint(double[] xx,
int dim)
xx - array of dimension dimdim - dimensionpublic DataPoint(double[] xx)
xx - arraypublic int getDimension()
public void assignToCluster(int _clusterNumber)
_clusterNumber - the cluster to which this data point is to be assignedpublic int getClusterNumber()
public double getAttribute(int index)
index - current idexpublic void showAttributes()
public static double distance(DataPoint dp1, DataPoint dp2)
dp1 - the first data pointdp2 - the second data pointpublic static double distanceSqrt(DataPoint dp1, DataPoint dp2)
dp1 - the first data pointdp2 - the second data pointpublic String toString()
public static void main(String[] args)
args - command line argumentsDMelt 2.0 © DataMelt by jWork.ORG