|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math3.ml.clustering.Clusterer<T>
org.apache.commons.math3.ml.clustering.KMeansPlusPlusClusterer<T>
T
- type of the points to clusterpublic class KMeansPlusPlusClusterer<T extends Clusterable>
Clustering algorithm based on David Arthur and Sergei Vassilvitski k-means++ algorithm.
Nested Class Summary | |
---|---|
static class |
KMeansPlusPlusClusterer.EmptyClusterStrategy
Strategies to use for replacing an empty cluster. |
Constructor Summary | |
---|---|
KMeansPlusPlusClusterer(int k)
Build a clusterer. |
|
KMeansPlusPlusClusterer(int k,
int maxIterations)
Build a clusterer. |
|
KMeansPlusPlusClusterer(int k,
int maxIterations,
DistanceMeasure measure)
Build a clusterer. |
|
KMeansPlusPlusClusterer(int k,
int maxIterations,
DistanceMeasure measure,
RandomGenerator random)
Build a clusterer. |
|
KMeansPlusPlusClusterer(int k,
int maxIterations,
DistanceMeasure measure,
RandomGenerator random,
KMeansPlusPlusClusterer.EmptyClusterStrategy emptyStrategy)
Build a clusterer. |
Method Summary | |
---|---|
List<CentroidCluster<T>> |
cluster(Collection<T> points)
Runs the K-means++ clustering algorithm. |
KMeansPlusPlusClusterer.EmptyClusterStrategy |
getEmptyClusterStrategy()
Returns the KMeansPlusPlusClusterer.EmptyClusterStrategy used by this instance. |
int |
getK()
Return the number of clusters this instance will use. |
int |
getMaxIterations()
Returns the maximum number of iterations this instance will use. |
RandomGenerator |
getRandomGenerator()
Returns the random generator this instance will use. |
Methods inherited from class org.apache.commons.math3.ml.clustering.Clusterer |
---|
distance, getDistanceMeasure |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KMeansPlusPlusClusterer(int k)
The default strategy for handling empty clusters that may appear during algorithm iterations is to split the cluster with largest distance variance.
The euclidean distance will be used as default distance measure.
k
- the number of clusters to split the data intopublic KMeansPlusPlusClusterer(int k, int maxIterations)
The default strategy for handling empty clusters that may appear during algorithm iterations is to split the cluster with largest distance variance.
The euclidean distance will be used as default distance measure.
k
- the number of clusters to split the data intomaxIterations
- the maximum number of iterations to run the algorithm for.
If negative, no maximum will be used.public KMeansPlusPlusClusterer(int k, int maxIterations, DistanceMeasure measure)
The default strategy for handling empty clusters that may appear during algorithm iterations is to split the cluster with largest distance variance.
k
- the number of clusters to split the data intomaxIterations
- the maximum number of iterations to run the algorithm for.
If negative, no maximum will be used.measure
- the distance measure to usepublic KMeansPlusPlusClusterer(int k, int maxIterations, DistanceMeasure measure, RandomGenerator random)
The default strategy for handling empty clusters that may appear during algorithm iterations is to split the cluster with largest distance variance.
k
- the number of clusters to split the data intomaxIterations
- the maximum number of iterations to run the algorithm for.
If negative, no maximum will be used.measure
- the distance measure to userandom
- random generator to use for choosing initial centerspublic KMeansPlusPlusClusterer(int k, int maxIterations, DistanceMeasure measure, RandomGenerator random, KMeansPlusPlusClusterer.EmptyClusterStrategy emptyStrategy)
k
- the number of clusters to split the data intomaxIterations
- the maximum number of iterations to run the algorithm for.
If negative, no maximum will be used.measure
- the distance measure to userandom
- random generator to use for choosing initial centersemptyStrategy
- strategy to use for handling empty clusters that
may appear during algorithm iterationsMethod Detail |
---|
public int getK()
public int getMaxIterations()
public RandomGenerator getRandomGenerator()
public KMeansPlusPlusClusterer.EmptyClusterStrategy getEmptyClusterStrategy()
KMeansPlusPlusClusterer.EmptyClusterStrategy
used by this instance.
KMeansPlusPlusClusterer.EmptyClusterStrategy
public List<CentroidCluster<T>> cluster(Collection<T> points) throws MathIllegalArgumentException, ConvergenceException
cluster
in class Clusterer<T extends Clusterable>
points
- the points to cluster
MathIllegalArgumentException
- if the data points are null or the number
of clusters is larger than the number of data points
ConvergenceException
- if an empty cluster is encountered and the
emptyStrategy
is set to ERROR
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |