Package elki.clustering.hierarchical
Class AGNES.Instance
- java.lang.Object
-
- elki.clustering.hierarchical.AGNES.Instance
-
- Direct Known Subclasses:
Anderberg.Instance
,MedoidLinkage.Instance
,MiniMax.Instance
,NNChain.Instance
public static class AGNES.Instance extends java.lang.Object
Main worker instance of AGNES.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description protected ClusterMergeHistoryBuilder
builder
Cluster result builderprotected int
end
Active set sizeprotected Linkage
linkage
Current linkage method in use.protected ClusterDistanceMatrix
mat
Cluster distance matrix
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
findMerge()
Perform the next merge step in AGNES.protected void
merge(double mindist, int x, int y)
Execute the cluster merge.ClusterMergeHistory
run(ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder)
Run the main algorithm.protected static int
shrinkActiveSet(int[] clustermap, int end, int x)
Shrink the active set: if the last x objects are all merged, we can reduce the working size accordingly.protected void
updateMatrix(double mindist, int x, int y, int sizex, int sizey)
Update the scratch distance matrix.
-
-
-
Field Detail
-
linkage
protected Linkage linkage
Current linkage method in use.
-
mat
protected ClusterDistanceMatrix mat
Cluster distance matrix
-
builder
protected ClusterMergeHistoryBuilder builder
Cluster result builder
-
end
protected int end
Active set size
-
-
Constructor Detail
-
Instance
public Instance(Linkage linkage)
Constructor.- Parameters:
linkage
- Linkage
-
-
Method Detail
-
run
public ClusterMergeHistory run(ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder)
Run the main algorithm.- Parameters:
mat
- Distance matrixbuilder
- Result builder- Returns:
- Cluster history
-
findMerge
protected int findMerge()
Perform the next merge step in AGNES.- Returns:
- the index that has disappeared, for shrinking the working set
-
merge
protected void merge(double mindist, int x, int y)
Execute the cluster merge.- 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)
Update the scratch distance matrix.- Parameters:
mindist
- Minimum distancex
- First matrix positiony
- Second matrix positionsizex
- Old size of first clustersizey
- Old size of second cluster
-
shrinkActiveSet
protected static int shrinkActiveSet(int[] clustermap, int end, int x)
Shrink the active set: if the last x objects are all merged, we can reduce the working size accordingly.- Parameters:
clustermap
- Map to current clustersend
- Current active set sizex
- Last merged object- Returns:
- New active set size
-
-