Top Description Fields Constructors Methods
org.apache.commons.math3.ml.clustering

public abstract Class Clusterer<T extends Clusterable>

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.math3.ml.clustering.DBSCANClusterer, org.apache.commons.math3.ml.clustering.FuzzyKMeansClusterer, org.apache.commons.math3.ml.clustering.KMeansPlusPlusClusterer, org.apache.commons.math3.ml.clustering.MultiKMeansPlusPlusClusterer
Type Parameters
<T>
the type of points that can be clustered
Imports
java.util.Collection, .List, org.apache.commons.math3.exception.ConvergenceException, .MathIllegalArgumentException, org.apache.commons.math3.ml.distance.DistanceMeasure

Base class for clustering algorithms.
Since
3.2

Field Summary

Modifier and TypeField and Description
private DistanceMeasure
measure

The distance measure to use.

Constructor Summary

AccessConstructor and Description
protected
Clusterer(final DistanceMeasure
the distance measure to use
measure
)

Build a new clusterer with the given DistanceMeasure.

Method Summary

Modifier and TypeMethod and Description
public abstract List<? extends Cluster<T>>

Returns:

a List of clusters
cluster
(Collection<T>
the set of Clusterable instances
points
)

Perform a cluster analysis on the given set of Clusterable instances.

protected double

Returns:

the distance between the two clusterables
distance
(final Clusterable
the first clusterable
p1
,
final Clusterable
the second clusterable
p2
)

Calculates the distance between two Clusterable instances with the configured DistanceMeasure.

public DistanceMeasure

Returns:

the distance measure
getDistanceMeasure
()

Returns the DistanceMeasure instance used by this clusterer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

measureback to summary
private DistanceMeasure measure

The distance measure to use.

Constructor Detail

Clustererback to summary
protected Clusterer(final DistanceMeasure measure)

Build a new clusterer with the given DistanceMeasure.

Parameters
measure:DistanceMeasure

the distance measure to use

Method Detail

clusterback to summary
public abstract List<? extends Cluster<T>> cluster(Collection<T> points) throws MathIllegalArgumentException, ConvergenceException

Perform a cluster analysis on the given set of Clusterable instances.

Parameters
points:Collection<T>

the set of Clusterable instances

Returns:List<? extends Cluster<T>>

a List of clusters

Exceptions
MathIllegalArgumentException:
if points are null or the number of data points is not compatible with this clusterer
ConvergenceException:
if the algorithm has not yet converged after the maximum number of iterations has been exceeded
distanceback to summary
protected double distance(final Clusterable p1, final Clusterable p2)

Calculates the distance between two Clusterable instances with the configured DistanceMeasure.

Parameters
p1:Clusterable

the first clusterable

p2:Clusterable

the second clusterable

Returns:double

the distance between the two clusterables

getDistanceMeasureback to summary
public DistanceMeasure getDistanceMeasure()

Returns the DistanceMeasure instance used by this clusterer.

Returns:DistanceMeasure

the distance measure