V
- vector datatypepublic class KMeansBatchedLloyd<V extends NumberVector> extends AbstractKMeans<V,KMeansModel>
Modifier and Type | Class and Description |
---|---|
static class |
KMeansBatchedLloyd.Parameterizer<V extends NumberVector>
Parameterization class.
|
Modifier and Type | Field and Description |
---|---|
(package private) int |
blocks
Number of blocks to use.
|
private static String |
KEY
Key for statistics logging.
|
private static Logging |
LOG
The logger for this class.
|
(package private) RandomFactory |
random
Random used for partitioning.
|
initializer, k, maxiter
distanceFunction
INIT_ID, K_ID, MAXITER_ID, SEED_ID
DISTANCE_FUNCTION_ID
Constructor and Description |
---|
KMeansBatchedLloyd(NumberVectorDistanceFunction<? super V> distanceFunction,
int k,
int maxiter,
KMeansInitialization<? super V> initializer,
int blocks,
RandomFactory random)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
assignToNearestCluster(Relation<V> relation,
DBIDs ids,
List<? extends NumberVector> oldmeans,
double[][] meanshift,
int[] changesize,
List<? extends ModifiableDBIDs> clusters,
WritableIntegerDataStore assignment,
double[] varsum)
Returns a list of clusters.
|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
Clustering<KMeansModel> |
run(Database database,
Relation<V> relation)
Run the clustering algorithm.
|
protected boolean |
updateAssignment(DBIDIter id,
V fv,
List<? extends ModifiableDBIDs> clusters,
WritableIntegerDataStore assignment,
double[][] meanshift,
int[] changesize,
int minIndex)
Update the assignment of a single object.
|
protected void |
updateMeans(List<Vector> means,
double[][] meanshift,
List<ModifiableDBIDs> clusters,
int[] changesize)
Merge changes into mean vectors.
|
assignToNearestCluster, getInputTypeRestriction, incrementalUpdateMean, logVarstat, macQueenIterate, means, medians, setDistanceFunction, setK, updateAssignment
getDistanceFunction
makeParameterDistanceFunction, run
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run
getDistanceFunction
private static final Logging LOG
private static final String KEY
int blocks
RandomFactory random
public KMeansBatchedLloyd(NumberVectorDistanceFunction<? super V> distanceFunction, int k, int maxiter, KMeansInitialization<? super V> initializer, int blocks, RandomFactory random)
distanceFunction
- distance functionk
- k parametermaxiter
- Maxiter parameterinitializer
- Initialization methodblocks
- Number of blocksrandom
- Random factory used for partitioning.public Clustering<KMeansModel> run(Database database, Relation<V> relation)
KMeans
database
- Database to run on.relation
- Relation to process.protected boolean assignToNearestCluster(Relation<V> relation, DBIDs ids, List<? extends NumberVector> oldmeans, double[][] meanshift, int[] changesize, List<? extends ModifiableDBIDs> clusters, WritableIntegerDataStore assignment, double[] varsum)
relation
- the database to clusterids
- IDs to processoldmeans
- a list of k meansmeanshift
- delta to apply to each meanchangesize
- New cluster sizesclusters
- cluster assignmentassignment
- Current cluster assignmentvarsum
- Sum of variancesprotected boolean updateAssignment(DBIDIter id, V fv, List<? extends ModifiableDBIDs> clusters, WritableIntegerDataStore assignment, double[][] meanshift, int[] changesize, int minIndex)
id
- Object to assignfv
- Vectorclusters
- Clustersassignment
- Current cluster assignmentmeanshift
- Current shifting offsetchangesize
- Size change of the current clusterminIndex
- Index of best cluster.true
when assignment changed.protected void updateMeans(List<Vector> means, double[][] meanshift, List<ModifiableDBIDs> clusters, int[] changesize)
means
- Mean vectorsmeanshift
- Shift offsetclusters
- changesize
- Size of change (for weighting!)protected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<Clustering<KMeansModel>>
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.