T
- type of the points to clusterpublic class KMeansPlusPlusClusterer<T extends Clusterable<T>> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
KMeansPlusPlusClusterer.EmptyClusterStrategy
Strategies to use for replacing an empty cluster.
|
Constructor and Description |
---|
KMeansPlusPlusClusterer(Random randomIn)
Build a clusterer.
|
KMeansPlusPlusClusterer(Random randomIn,
KMeansPlusPlusClusterer.EmptyClusterStrategy emptyStrategyIn)
Build a clusterer.
|
Modifier and Type | Method and Description |
---|---|
List<Cluster<T>> |
cluster(Collection<T> points,
int k,
int maxIterations)
Runs the K-means++ clustering algorithm.
|
List<Cluster<T>> |
cluster(Collection<T> points,
int k,
int numTrials,
int maxIterationsPerTrial)
Runs the K-means++ clustering algorithm.
|
public KMeansPlusPlusClusterer(Random randomIn)
The default strategy for handling empty clusters that may appear during algorithm iterations is to split the cluster with largest distance variance.
randomIn
- random generator to use for choosing initial centerspublic KMeansPlusPlusClusterer(Random randomIn, KMeansPlusPlusClusterer.EmptyClusterStrategy emptyStrategyIn)
randomIn
- random generator to use for choosing initial centersemptyStrategyIn
- strategy to use for handling empty clusters that
may appear during algorithm iterationspublic List<Cluster<T>> cluster(Collection<T> points, int k, int numTrials, int maxIterationsPerTrial)
points
- the points to clusterk
- the number of clusters to split the data intonumTrials
- number of trial runsmaxIterationsPerTrial
- the maximum number of iterations to run the algorithm
for at each trial run. If negative, no maximum will be usedMathIllegalArgumentException
- if the data points are null or the number
of clusters is larger than the number of data pointsConvergenceException
- if an empty cluster is encountered and the emptyStrategy
is set to ERROR
public List<Cluster<T>> cluster(Collection<T> points, int k, int maxIterations)
points
- the points to clusterk
- 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 usedMathIllegalArgumentException
- if the data points are null or the number
of clusters is larger than the number of data pointsConvergenceException
- if an empty cluster is encountered and the emptyStrategy
is set to ERROR
Copyright © 2020 CNES. All rights reserved.