Package elki.clustering.kmeans
Class YinYangKMeans.Instance
- java.lang.Object
-
- elki.clustering.kmeans.AbstractKMeans.Instance
-
- elki.clustering.kmeans.YinYangKMeans.Instance
-
- Enclosing class:
- YinYangKMeans<V extends NumberVector>
protected static class YinYangKMeans.Instance extends AbstractKMeans.Instance
Instance for a particular data set.- Author:
- Minh Nhat Nguyen, Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) double[]
cdrift
Distance moved by each center.(package private) double[]
gdrift
Maximum distance moved within each group.(package private) int[]
glabel
Group label of each mean(package private) int[][]
groups
Center list for each group(package private) WritableDataStore<double[]>
lower
Lower bounds(package private) double[][]
sums
Current cluster sum.(package private) WritableDoubleDataStore
upper
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, NumberVectorDistance<?> df, double[][] means, int t)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
assignToNearestCluster()
Reassign objects, but avoid unnecessary computations based on their bounds.protected Logging
getLogger()
Get the class logger.private int[][]
groupKMeans(int t)
Groups the initial centers into t groups.private int
initialAssignToNearestCluster()
Perform initial cluster assignment,private void
initialGroupAssignment(int t, double[][] scratch, int[] gweight)
Initial k-means assignment for centers to groups.protected int
iterate(int iteration)
Main loop function.void
run(int maxiter)
Run the clustering.private void
updateCenters()
Update centers and how much they moved.private boolean
updateGroupAssignment(int t, double[][] gmeans, int[] gweight)
Perform one step of Voronoi refinement.-
Methods inherited from class elki.clustering.kmeans.AbstractKMeans.Instance
buildResult, buildResult, computeSquaredSeparation, copyMeans, distance, distance, distance, initialSeperation, meansFromSums, movedDistance, recomputeSeperation, recomputeVariance, sqrtdistance, sqrtdistance, sqrtdistance
-
-
-
-
Field Detail
-
groups
int[][] groups
Center list for each group
-
gdrift
double[] gdrift
Maximum distance moved within each group.
-
cdrift
double[] cdrift
Distance moved by each center.
-
sums
double[][] sums
Current cluster sum.
-
glabel
int[] glabel
Group label of each mean
-
upper
WritableDoubleDataStore upper
Upper bound
-
lower
WritableDataStore<double[]> lower
Lower bounds
-
-
Constructor Detail
-
Instance
public Instance(Relation<? extends NumberVector> relation, NumberVectorDistance<?> df, double[][] means, int t)
Constructor.- Parameters:
relation
- Data relationdf
- Distance functionmeans
- Initial meanst
- Number of groups to use
-
-
Method Detail
-
run
public void run(int maxiter)
Description copied from class:AbstractKMeans.Instance
Run the clustering.- Overrides:
run
in classAbstractKMeans.Instance
- Parameters:
maxiter
- Maximum number of iterations
-
groupKMeans
private int[][] groupKMeans(int t)
Groups the initial centers into t groups.- Parameters:
t
- Number of groups- Returns:
- a list of groups containing mean indices.
-
initialGroupAssignment
private void initialGroupAssignment(int t, double[][] scratch, int[] gweight)
Initial k-means assignment for centers to groups.- Parameters:
t
- Number of groupsscratch
- Scratch space for meansgweight
- group weights
-
updateGroupAssignment
private boolean updateGroupAssignment(int t, double[][] gmeans, int[] gweight)
Perform one step of Voronoi refinement.- Parameters:
t
- Number of groupsgmeans
- current group meansgweight
- Group weight- Returns:
- true if changed
-
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
-
updateCenters
private void updateCenters()
Update centers and how much they moved.
-
assignToNearestCluster
protected int assignToNearestCluster()
Reassign objects, but avoid unnecessary computations based on their bounds.- Overrides:
assignToNearestCluster
in classAbstractKMeans.Instance
- Returns:
- number of objects reassigned
-
initialAssignToNearestCluster
private int initialAssignToNearestCluster()
Perform initial cluster assignment,- Returns:
- number of changes (i.e. relation size)
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractKMeans.Instance
Get the class logger.- Specified by:
getLogger
in classAbstractKMeans.Instance
- Returns:
- Logger
-
-