Class Cluster<T extends Clusterable>
- java.lang.Object
-
- org.apache.commons.math4.legacy.ml.clustering.Cluster<T>
-
- Type Parameters:
T
- the type of points that can be clustered
- Direct Known Subclasses:
CentroidCluster
public class Cluster<T extends Clusterable> extends Object
Cluster holding a set ofClusterable
points.- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description Cluster()
Build a cluster centered at a specified point.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPoint(T point)
Add a point to this cluster.Clusterable
centroid()
Computes the centroid of the cluster.List<T>
getPoints()
Get the points contained in the cluster.
-
-
-
Constructor Detail
-
Cluster
public Cluster()
Build a cluster centered at a specified point.
-
-
Method Detail
-
addPoint
public void addPoint(T point)
Add a point to this cluster.- Parameters:
point
- point to add
-
getPoints
public List<T> getPoints()
Get the points contained in the cluster.- Returns:
- points contained in the cluster
-
centroid
public Clusterable centroid()
Computes the centroid of the cluster.- Returns:
- the centroid for the cluster, or
null
if the cluster does not contain any points.
-
-