Package org.hipparchus.clustering
Class Clusterer<T extends Clusterable>
java.lang.Object
org.hipparchus.clustering.Clusterer<T>
- Type Parameters:
T
- the type of points that can be clustered
- Direct Known Subclasses:
DBSCANClusterer
,FuzzyKMeansClusterer
,KMeansPlusPlusClusterer
,MultiKMeansPlusPlusClusterer
Base class for clustering algorithms.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Clusterer
(DistanceMeasure measure) Build a new clusterer with the givenDistanceMeasure
. -
Method Summary
Modifier and TypeMethodDescriptioncluster
(Collection<T> points) Perform a cluster analysis on the given set ofClusterable
instances.protected double
distance
(Clusterable p1, Clusterable p2) Calculates the distance between twoClusterable
instances with the configuredDistanceMeasure
.Returns theDistanceMeasure
instance used by this clusterer.
-
Constructor Details
-
Clusterer
Build a new clusterer with the givenDistanceMeasure
.- Parameters:
measure
- the distance measure to use
-
-
Method Details
-
cluster
public abstract List<? extends Cluster<T>> cluster(Collection<T> points) throws MathIllegalArgumentException, MathIllegalStateException Perform a cluster analysis on the given set ofClusterable
instances.- Parameters:
points
- the set ofClusterable
instances- Returns:
- a
List
of clusters - Throws:
MathIllegalArgumentException
- if points are null or the number of data points is not compatible with this clustererMathIllegalStateException
- if the algorithm has not yet converged after the maximum number of iterations has been exceeded
-
getDistanceMeasure
Returns theDistanceMeasure
instance used by this clusterer.- Returns:
- the distance measure
-
distance
Calculates the distance between twoClusterable
instances with the configuredDistanceMeasure
.- Parameters:
p1
- the first clusterablep2
- the second clusterable- Returns:
- the distance between the two clusterables
-