Package elki.clustering.kmeans.spherical
Class SphericalHamerlyKMeans.Instance
- java.lang.Object
-
- elki.clustering.kmeans.AbstractKMeans.Instance
-
- elki.clustering.kmeans.spherical.SphericalKMeans.Instance
-
- elki.clustering.kmeans.spherical.SphericalHamerlyKMeans.Instance
-
- Enclosing class:
- SphericalHamerlyKMeans<V extends NumberVector>
protected static class SphericalHamerlyKMeans.Instance extends SphericalKMeans.Instance
Inner instance, storing state for a single data set.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) double[]
csim
Cluster self-similarity.(package private) WritableDoubleDataStore
lsim
Similarity lower bound.(package private) double[][]
newmeans
Scratch space for new means.(package private) double[][]
sums
Sum aggregate for the new mean.(package private) WritableDoubleDataStore
usim
Similarity upper bound.-
Fields inherited from class elki.clustering.kmeans.AbstractKMeans.Instance
assignment, clusters, diststat, isSquared, k, key, means, relation, varsum
-
-
Constructor Summary
Constructors Constructor Description Instance(Relation<? extends NumberVector> relation, double[][] means)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
assignToNearestCluster()
Assign each object to the nearest cluster.protected Logging
getLogger()
Get the class logger.protected int
initialAssignToNearestCluster()
Perform initial cluster assignment.int
iterate(int iteration)
Main loop function.protected void
recomputeSeperation(double[] csim)
Recompute the separation of cluster means.protected void
updateBounds(double[] msim)
Update the bounds for k-means.-
Methods inherited from class elki.clustering.kmeans.spherical.SphericalKMeans.Instance
distance, distance, distance, initialSeparation, means, meansFromSums, movedSimilarity, recomputeVariance, similarity, similarity, sqrtdistance, sqrtdistance
-
Methods inherited from class elki.clustering.kmeans.AbstractKMeans.Instance
buildResult, buildResult, computeSquaredSeparation, copyMeans, initialSeperation, movedDistance, recomputeSeperation, run, sqrtdistance
-
-
-
-
Field Detail
-
sums
double[][] sums
Sum aggregate for the new mean.
-
newmeans
double[][] newmeans
Scratch space for new means.
-
lsim
WritableDoubleDataStore lsim
Similarity lower bound.
-
usim
WritableDoubleDataStore usim
Similarity upper bound.
-
csim
double[] csim
Cluster self-similarity.
-
-
Constructor Detail
-
Instance
public Instance(Relation<? extends NumberVector> relation, double[][] means)
Constructor.- Parameters:
relation
- Relationmeans
- Initial means
-
-
Method Detail
-
iterate
public int iterate(int iteration)
Description copied from class:AbstractKMeans.Instance
Main loop function.- Overrides:
iterate
in classSphericalKMeans.Instance
- Parameters:
iteration
- Iteration number (beginning at 1)- Returns:
- Number of reassigned points
-
initialAssignToNearestCluster
protected int initialAssignToNearestCluster()
Perform initial cluster assignment.- Returns:
- Number of changes (i.e., relation size)
-
recomputeSeperation
protected void recomputeSeperation(double[] csim)
Recompute the separation of cluster means.Used by Hamerly.
- Parameters:
csim
- Output array of separation
-
assignToNearestCluster
protected int assignToNearestCluster()
Description copied from class:AbstractKMeans.Instance
Assign each object to the nearest cluster.- Overrides:
assignToNearestCluster
in classSphericalKMeans.Instance
- Returns:
- number of objects reassigned
-
updateBounds
protected void updateBounds(double[] msim)
Update the bounds for k-means.- Parameters:
msim
- Similarity movement of centers
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractKMeans.Instance
Get the class logger.- Overrides:
getLogger
in classSphericalKMeans.Instance
- Returns:
- Logger
-
-