Package elki.clustering.kmeans
Class KMeansMinusMinus.Instance
- java.lang.Object
-
- elki.clustering.kmeans.AbstractKMeans.Instance
-
- elki.clustering.kmeans.KMeansMinusMinus.Instance
-
- Enclosing class:
- KMeansMinusMinus<V extends NumberVector>
protected class KMeansMinusMinus.Instance extends AbstractKMeans.Instance
Inner instance, storing state for a single data set.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.List<ModifiableDoubleDBIDList>
clusters
Cluster storage.(package private) int
heapsize
Desired size of the heap.(package private) DoubleMinHeap
minHeap
Heap of the noise candidates.(package private) double
prevvartotal
Variance of the previous iteration-
Fields inherited from class elki.clustering.kmeans.AbstractKMeans.Instance
assignment, diststat, isSquared, k, key, means, relation, varsum
-
-
Constructor Summary
Constructors Constructor Description Instance(Relation<? extends NumberVector> relation, NumberVectorDistance<?> df, double[][] means)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
assignToNearestCluster()
Returns a list of clusters.protected Clustering<KMeansModel>
buildResultWithNoise()
protected Logging
getLogger()
Get the class logger.protected int
iterate(int iteration)
Main loop function.protected double[][]
meansWithTreshhold(double tresh)
Returns the mean vectors of the given clusters in the given database.-
Methods inherited from class elki.clustering.kmeans.AbstractKMeans.Instance
buildResult, buildResult, computeSquaredSeparation, copyMeans, distance, distance, distance, initialSeperation, meansFromSums, movedDistance, recomputeSeperation, recomputeVariance, run, sqrtdistance, sqrtdistance, sqrtdistance
-
-
-
-
Field Detail
-
minHeap
DoubleMinHeap minHeap
Heap of the noise candidates.
-
heapsize
int heapsize
Desired size of the heap.
-
prevvartotal
double prevvartotal
Variance of the previous iteration
-
clusters
java.util.List<ModifiableDoubleDBIDList> clusters
Cluster storage.
-
-
Constructor Detail
-
Instance
public Instance(Relation<? extends NumberVector> relation, NumberVectorDistance<?> df, double[][] means)
Constructor.- Parameters:
relation
- Relationdf
- Distance functionmeans
- Initial means
-
-
Method Detail
-
iterate
protected int iterate(int iteration)
Description copied from class:AbstractKMeans.Instance
Main loop function.- Specified by:
iterate
in classAbstractKMeans.Instance
- Parameters:
iteration
- Iteration number (beginning at 1)- Returns:
- Number of reassigned points
-
buildResultWithNoise
protected Clustering<KMeansModel> buildResultWithNoise()
-
assignToNearestCluster
protected int assignToNearestCluster()
Returns a list of clusters. The kth cluster contains the ids of those FeatureVectors, that are nearest to the kth mean. And saves the distance in a MinHeap.- Overrides:
assignToNearestCluster
in classAbstractKMeans.Instance
- Returns:
- the number of reassigned objects
-
meansWithTreshhold
protected double[][] meansWithTreshhold(double tresh)
Returns the mean vectors of the given clusters in the given database.- Parameters:
tresh
- Threshold- Returns:
- the mean vectors of the given clusters in the given database
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractKMeans.Instance
Get the class logger.- Specified by:
getLogger
in classAbstractKMeans.Instance
- Returns:
- Logger
-
-