V
- Vector typepublic class SameSizeKMeansAlgorithm<V extends NumberVector> extends AbstractKMeans<V,MeanModel>
Modifier and Type | Class and Description |
---|---|
private class |
SameSizeKMeansAlgorithm.Meta
Object metadata.
|
static class |
SameSizeKMeansAlgorithm.Parameterizer<V extends NumberVector>
Parameterization class.
|
class |
SameSizeKMeansAlgorithm.PreferenceComparator
Sort a list of integers (= cluster numbers) by the distances.
|
Modifier and Type | Field and Description |
---|---|
private static Logging |
LOG
Class logger
|
initializer, k, maxiter
distanceFunction
INIT_ID, K_ID, MAXITER_ID, SEED_ID
DISTANCE_FUNCTION_ID
Constructor and Description |
---|
SameSizeKMeansAlgorithm(NumberVectorDistanceFunction<? super V> distanceFunction,
int k,
int maxiter,
KMeansInitialization<? super V> initializer)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
protected ArrayModifiableDBIDs |
initialAssignment(List<ModifiableDBIDs> clusters,
WritableDataStore<SameSizeKMeansAlgorithm.Meta> metas,
DBIDs ids) |
protected WritableDataStore<SameSizeKMeansAlgorithm.Meta> |
initializeMeta(Relation<V> relation,
List<? extends NumberVector> means)
Initialize the metadata storage.
|
protected List<Vector> |
refineResult(Relation<V> relation,
List<Vector> means,
List<ModifiableDBIDs> clusters,
WritableDataStore<SameSizeKMeansAlgorithm.Meta> metas,
ArrayModifiableDBIDs tids)
Perform k-means style iterations to improve the clustering result.
|
Clustering<MeanModel> |
run(Database database,
Relation<V> relation)
Run k-means with cluster size constraints.
|
protected void |
transfer(WritableDataStore<SameSizeKMeansAlgorithm.Meta> metas,
SameSizeKMeansAlgorithm.Meta meta,
ModifiableDBIDs src,
ModifiableDBIDs dst,
DBIDRef id,
Integer dstnum)
Transfer a single element from one cluster to another.
|
protected void |
updateDistances(Relation<V> relation,
List<Vector> means,
WritableDataStore<SameSizeKMeansAlgorithm.Meta> metas,
NumberVectorDistanceFunction<? super V> df)
Compute the distances of each object to all means.
|
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
public SameSizeKMeansAlgorithm(NumberVectorDistanceFunction<? super V> distanceFunction, int k, int maxiter, KMeansInitialization<? super V> initializer)
distanceFunction
- Distance functionk
- K parametermaxiter
- Maximum number of iterationsinitializer
- public Clustering<MeanModel> run(Database database, Relation<V> relation)
database
- Databaserelation
- relation to useprotected WritableDataStore<SameSizeKMeansAlgorithm.Meta> initializeMeta(Relation<V> relation, List<? extends NumberVector> means)
relation
- Relation to processmeans
- Mean vectorsprotected ArrayModifiableDBIDs initialAssignment(List<ModifiableDBIDs> clusters, WritableDataStore<SameSizeKMeansAlgorithm.Meta> metas, DBIDs ids)
protected void updateDistances(Relation<V> relation, List<Vector> means, WritableDataStore<SameSizeKMeansAlgorithm.Meta> metas, NumberVectorDistanceFunction<? super V> df)
SameSizeKMeansAlgorithm.Meta.secondary
to point to the best cluster number except the
current cluster assignmentrelation
- Data relationmeans
- Meansmetas
- Metadata storagedf
- Distance functionprotected List<Vector> refineResult(Relation<V> relation, List<Vector> means, List<ModifiableDBIDs> clusters, WritableDataStore<SameSizeKMeansAlgorithm.Meta> metas, ArrayModifiableDBIDs tids)
relation
- Data relationmeans
- Means listclusters
- Cluster listmetas
- Metadata storagetids
- DBIDs arrayprotected void transfer(WritableDataStore<SameSizeKMeansAlgorithm.Meta> metas, SameSizeKMeansAlgorithm.Meta meta, ModifiableDBIDs src, ModifiableDBIDs dst, DBIDRef id, Integer dstnum)
metas
- Meta storagemeta
- Meta of current objectsrc
- Source clusterdst
- Destination clusterid
- Object IDdstnum
- Destination cluster numberprotected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<Clustering<MeanModel>>
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.