Package elki.clustering.hierarchical
Class MiniMax.Instance
- java.lang.Object
-
- elki.clustering.hierarchical.AGNES.Instance
-
- elki.clustering.hierarchical.MiniMax.Instance
-
- Direct Known Subclasses:
MiniMaxAnderberg.Instance,MiniMaxNNChain.Instance
public static class MiniMax.Instance extends AGNES.Instance
Main worker instance of MiniMax.- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description protected it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<ModifiableDBIDs>clustersMap to cluster membersprotected DistanceQuery<?>dqDistance query functionprotected DBIDArrayIterixIterators into the object ids.protected DBIDArrayIteriyIterators into the object ids.protected DBIDArrayMIterprotiterIterator into prototype cache-
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 doublefindMax(DistanceQuery<?> dq, DBIDIter i, DBIDs cy, double maxDist, double minMaxDist)Find the maximum distance of one object to a set.protected intfindMerge()Perform the next merge step in AGNES.private static doublefindPrototype(DistanceQuery<?> dq, DBIDs cx, DBIDs cy, DBIDVar prototype, double minMaxDist)Find the prototypes.private static doublefindPrototypeSingleton(DistanceQuery<?> dq, DBIDs cx, DBIDRef cy, DBIDVar prototype)Find the prototypes.protected voidmerge(int x, int y)Merges two clusters given by x, y, their points with smallest IDs, and y to keepClusterMergeHistoryrun(ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder)Run the main algorithm.ClusterPrototypeMergeHistoryrun(ArrayDBIDs ids, ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder, DistanceQuery<?> dq, DBIDArrayMIter prots)protected voidupdateEntry(int x, int y)Update entry at x,y for distance matrix distancesprotected voidupdateMatrices(int c)Update the entries of the matrices that contain a distance to c, the newly merged cluster.-
Methods inherited from class elki.clustering.hierarchical.AGNES.Instance
merge, shrinkActiveSet, updateMatrix
-
-
-
-
Field Detail
-
clusters
protected it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<ModifiableDBIDs> clusters
Map to cluster members
-
protiter
protected DBIDArrayMIter protiter
Iterator into prototype cache
-
dq
protected DistanceQuery<?> dq
Distance query function
-
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.InstanceRun the main algorithm.- Overrides:
runin classAGNES.Instance- Parameters:
mat- Distance matrixbuilder- Result builder- Returns:
- Cluster history
-
run
public ClusterPrototypeMergeHistory run(ArrayDBIDs ids, ClusterDistanceMatrix mat, ClusterMergeHistoryBuilder builder, DistanceQuery<?> dq, DBIDArrayMIter prots)
-
findMerge
protected int findMerge()
Description copied from class:AGNES.InstancePerform the next merge step in AGNES.- Overrides:
findMergein classAGNES.Instance- Returns:
- the index that has disappeared, for shrinking the working set
-
merge
protected void merge(int x, int y)Merges two clusters given by x, y, their points with smallest IDs, and y to keep- Parameters:
x- first cluster to mergey- second cluster to merge
-
updateMatrices
protected void updateMatrices(int c)
Update the entries of the matrices that contain a distance to c, the newly merged cluster.- Parameters:
c- the cluster to update distances to
-
updateEntry
protected void updateEntry(int x, int y)Update entry at x,y for distance matrix distances- Parameters:
x- index of cluster,x > yy- index of cluster,y < x
-
findPrototype
private static double findPrototype(DistanceQuery<?> dq, DBIDs cx, DBIDs cy, DBIDVar prototype, double minMaxDist)
Find the prototypes.- Parameters:
dq- Distance querycx- First setcy- Second setprototype- Prototype output variableminMaxDist- Previously best distance.- Returns:
- New best distance
-
findPrototypeSingleton
private static double findPrototypeSingleton(DistanceQuery<?> dq, DBIDs cx, DBIDRef cy, DBIDVar prototype)
Find the prototypes.- Parameters:
dq- Distance querycx- First setcy- Singleton objectprototype- Prototype output variable- Returns:
- New best distance
-
findMax
private static double findMax(DistanceQuery<?> dq, DBIDIter i, DBIDs cy, double maxDist, double minMaxDist)
Find the maximum distance of one object to a set.- Parameters:
dq- Distance queryi- Current objectcy- Set of candidatesmaxDist- Known maximum to othersminMaxDist- Early stopping threshold- Returns:
- Maximum distance
-
-