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
ConstructorsModifierConstructorDescriptionprotectedClusterer(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 ofClusterableinstances.protected doubledistance(Clusterable p1, Clusterable p2) Calculates the distance between twoClusterableinstances with the configuredDistanceMeasure.Returns theDistanceMeasureinstance 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 ofClusterableinstances.- Parameters:
points- the set ofClusterableinstances- Returns:
- a
Listof 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 theDistanceMeasureinstance used by this clusterer.- Returns:
- the distance measure
-
distance
Calculates the distance between twoClusterableinstances with the configuredDistanceMeasure.- Parameters:
p1- the first clusterablep2- the second clusterable- Returns:
- the distance between the two clusterables
-