Package elki.clustering.hierarchical
Class Anderberg.Instance
- java.lang.Object
-
- elki.clustering.hierarchical.AGNES.Instance
-
- elki.clustering.hierarchical.Anderberg.Instance
-
- Direct Known Subclasses:
HACAM.Instance
public static class Anderberg.Instance extends AGNES.Instance
Main worker instance of Anderberg's algorithm.- Author:
- Erich Schubert
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidfindBest(double[] scratch, double[] bestd, int[] besti, int j)Find the best in a row of the triangular matrix.protected intfindMerge()Perform the next merge step.protected static voidinitializeNNCache(double[] scratch, double[] bestd, int[] besti)Initialize the NN cache.protected voidmerge(double mindist, int x, int y)Execute the cluster merge.ClusterMergeHistoryrun(ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder)Run the main algorithm.protected static voidupdateCache(double[] scratch, double[] bestd, int[] besti, int x, int y, int j, double d)Update the cache.protected voidupdateMatrix(double mindist, int x, int y, int sizex, int sizey)Update the scratch distance matrix.-
Methods inherited from class elki.clustering.hierarchical.AGNES.Instance
shrinkActiveSet
-
-
-
-
Constructor Detail
-
Instance
public Instance(Linkage linkage)
Constructor.- Parameters:
linkage- Linkage method
-
-
Method Detail
-
run
public ClusterMergeHistory run(ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder)
Description copied from class:AGNES.InstanceRun the main algorithm.- Overrides:
runin classAGNES.Instance- Parameters:
mat- Distance matrixbuilder- Result builder- Returns:
- Cluster history
-
initializeNNCache
protected static void initializeNNCache(double[] scratch, double[] bestd, int[] besti)Initialize the NN cache.- Parameters:
scratch- Scratch spacebestd- Best distancebesti- Best index
-
findMerge
protected int findMerge()
Perform the next merge step.Due to the cache, this is now O(n) each time, instead of O(n*n).
- Overrides:
findMergein classAGNES.Instance- Returns:
- x, for shrinking the working set.
-
merge
protected void merge(double mindist, int x, int y)Description copied from class:AGNES.InstanceExecute the cluster merge.- Overrides:
mergein classAGNES.Instance- Parameters:
mindist- Distance that was used for mergingx- First matrix positiony- Second matrix position
-
updateMatrix
protected void updateMatrix(double mindist, int x, int y, int sizex, int sizey)Description copied from class:AGNES.InstanceUpdate the scratch distance matrix.- Overrides:
updateMatrixin classAGNES.Instance- Parameters:
mindist- Minimum distancex- First matrix positiony- Second matrix positionsizex- Old size of first clustersizey- Old size of second cluster
-
updateCache
protected static void updateCache(double[] scratch, double[] bestd, int[] besti, int x, int y, int j, double d)Update the cache.- Parameters:
scratch- Scratch matrixbestd- Best distancebesti- Best indexx- First clustery- Second cluster,y < xj- Updated value d(y, j)d- New distance
-
findBest
protected static void findBest(double[] scratch, double[] bestd, int[] besti, int j)Find the best in a row of the triangular matrix.- Parameters:
scratch- Scratch matrixbestd- Best distances cachebesti- Best indexes cachej- Row to update
-
-