|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unibz.algorithms.types.Centroid
public class Centroid
This class represent a centroid. This class is useful for example for the k-means algorithm that assigns each point to the cluster whose centroid is nearest. It contains the coordinates x, y and also an object of type cluster.
Field Summary | |
---|---|
private Cluster |
cluster
|
private double |
x
|
private double |
y
|
Constructor Summary | |
---|---|
Centroid(double x,
double y)
This constructor assigns only the coordinates to the centroid object |
Method Summary | |
---|---|
void |
calcCentroid()
This method retrieves the number of data points, then calculates the new centroid. |
double |
getClusterX()
This method returns the x coordinate of the cluster |
double |
getClusterY()
This method returns the y coordinate of the cluster |
void |
setCluster(Cluster c)
This method sets the cluster object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private double x
private double y
private Cluster cluster
Constructor Detail |
---|
public Centroid(double x, double y)
x
- coordinate xy
- coordinate yMethod Detail |
---|
public void calcCentroid()
public void setCluster(Cluster c)
c
- Cluster Objectpublic double getClusterX()
public double getClusterY()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |