Package elki.clustering.hierarchical
Class MedoidLinkage.Instance
- java.lang.Object
-
- elki.clustering.hierarchical.AGNES.Instance
-
- elki.clustering.hierarchical.MedoidLinkage.Instance
-
- Enclosing class:
- MedoidLinkage<O>
public static class MedoidLinkage.Instance extends AGNES.Instance
Main worker instance of AGNES.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description protected it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<ModifiableDBIDs>
clusters
Cluster to members mapprotected DistanceQuery<?>
dq
Distance queryprotected DBIDArrayIter
ix
Iterators into the object ids.protected DBIDArrayIter
iy
Iterators into the object ids.protected DBIDArrayMIter
mi
Iterators into medoid array.protected DBIDArrayMIter
mj
Iterators into medoid array.-
Fields inherited from class elki.clustering.hierarchical.AGNES.Instance
builder, end, linkage, mat
-
-
Constructor Summary
Constructors Constructor Description Instance()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static double
findMedoid(DistanceQuery<?> dq, DBIDs c, DBIDArrayMIter prototype)
Find the prototypes.protected int
findMerge()
Perform the next merge step in AGNES.protected void
merge(int x, int y)
Execute the cluster merge.ClusterMergeHistory
run(ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder)
Run the main algorithm.ClusterPrototypeMergeHistory
run(ArrayDBIDs ids, ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder, DistanceQuery<?> dq)
Run medoid linkageprotected void
updateMatrix(int x, int y)
Update the scratch distance matrix.-
Methods inherited from class elki.clustering.hierarchical.AGNES.Instance
merge, shrinkActiveSet, updateMatrix
-
-
-
-
Field Detail
-
clusters
protected it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<ModifiableDBIDs> clusters
Cluster to members map
-
dq
protected DistanceQuery<?> dq
Distance query
-
mi
protected DBIDArrayMIter mi
Iterators into medoid array.
-
mj
protected DBIDArrayMIter mj
Iterators into medoid array.
-
ix
protected DBIDArrayIter ix
Iterators into the object ids.
-
iy
protected DBIDArrayIter iy
Iterators into the object ids.
-
-
Method Detail
-
run
public ClusterMergeHistory run(ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder)
Description copied from class:AGNES.Instance
Run the main algorithm.- Overrides:
run
in classAGNES.Instance
- Parameters:
mat
- Distance matrixbuilder
- Result builder- Returns:
- Cluster history
-
run
public ClusterPrototypeMergeHistory run(ArrayDBIDs ids, ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder, DistanceQuery<?> dq)
Run medoid linkage- Parameters:
ids
- Object idsmat
- Distance matrixbuilder
- Result builderdq
- Distance query- Returns:
- Cluster merge history
-
findMerge
protected int findMerge()
Description copied from class:AGNES.Instance
Perform the next merge step in AGNES.- Overrides:
findMerge
in classAGNES.Instance
- Returns:
- the index that has disappeared, for shrinking the working set
-
merge
protected void merge(int x, int y)
Execute the cluster merge.- Parameters:
x
- first cluster to merge, withx > y
y
- second cluster to merge, withy < x
-
findMedoid
private static double findMedoid(DistanceQuery<?> dq, DBIDs c, DBIDArrayMIter prototype)
Find the prototypes.- Parameters:
dq
- Distance queryc
- Clusterprototype
- Prototype output- Returns:
- New best distance
-
updateMatrix
protected void updateMatrix(int x, int y)
Update the scratch distance matrix.- Parameters:
x
- First matrix positiony
- Second matrix position
-
-