@Reference(authors="M. R. Anderberg", title="Hierarchical Clustering Methods", booktitle="Cluster Analysis for Applications", bibkey="books/academic/Anderberg73/Ch6") @Priority(value=195) public class MiniMaxAnderberg<O> extends AbstractDistanceBasedAlgorithm<O,PointerHierarchyRepresentationResult> implements HierarchicalClusteringAlgorithm
This optimization is attributed to M. R. Anderberg.
This particular implementation is based on AnderbergHierarchicalClustering
Reference:
M. R. Anderberg
Hierarchical Clustering Methods
Cluster Analysis for Applications
ISBN: 0120576503
Modifier and Type | Class and Description |
---|---|
static class |
MiniMaxAnderberg.Parameterizer<O>
Parameterization class
|
Modifier and Type | Field and Description |
---|---|
private static Logging |
LOG
Class logger
|
ALGORITHM_ID
DISTANCE_FUNCTION_ID
Constructor and Description |
---|
MiniMaxAnderberg(DistanceFunction<? super O> distanceFunction)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
findBest(int size,
double[] scratch,
double[] bestd,
int[] besti,
int j) |
protected int |
findMerge(int size,
MatrixParadigm mat,
DBIDArrayMIter prots,
PointerHierarchyRepresentationBuilder builder,
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<ModifiableDBIDs> clusters,
double[] bestd,
int[] besti,
DistanceQuery<O> dq)
Perform the next merge step.
|
TypeInformation[] |
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.
|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
private static void |
initializeNNCache(double[] scratch,
double[] bestd,
int[] besti)
Initialize the NN cache.
|
protected void |
merge(int size,
MatrixParadigm mat,
DBIDArrayMIter prots,
PointerHierarchyRepresentationBuilder builder,
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<ModifiableDBIDs> clusters,
DistanceQuery<O> dq,
double[] bestd,
int[] besti,
int x,
int y)
Execute the cluster merge
|
PointerHierarchyRepresentationResult |
run(Database db,
Relation<O> relation)
Run the algorithm
|
private void |
updateCache(int size,
double[] scratch,
double[] bestd,
int[] besti,
int x,
int y,
int j,
double d)
Update the cache.
|
private void |
updateMatrices(int size,
MatrixParadigm mat,
DBIDArrayMIter prots,
PointerHierarchyRepresentationBuilder builder,
it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<ModifiableDBIDs> clusters,
DistanceQuery<O> dq,
double[] bestd,
int[] besti,
int x,
int y)
Update the entries of the matrices that contain a distance to y, the newly
merged cluster.
|
getDistanceFunction
run
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run
private static final Logging LOG
public MiniMaxAnderberg(DistanceFunction<? super O> distanceFunction)
distanceFunction
- Distance function to usepublic PointerHierarchyRepresentationResult run(Database db, Relation<O> relation)
db
- Databaserelation
- Relationprivate static void initializeNNCache(double[] scratch, double[] bestd, int[] besti)
scratch
- Scratch spacebestd
- Best distancebesti
- Best indexprotected int findMerge(int size, MatrixParadigm mat, DBIDArrayMIter prots, PointerHierarchyRepresentationBuilder builder, it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<ModifiableDBIDs> clusters, double[] bestd, int[] besti, DistanceQuery<O> dq)
size
- size of the data setmat
- matrix viewprots
- the prototypes of merges between clustersbuilder
- Result builderclusters
- the current clusteringbestd
- the distances to the nearest neighboring clusterbesti
- the nearest neighboring clusterdq
- the range queryprotected void merge(int size, MatrixParadigm mat, DBIDArrayMIter prots, PointerHierarchyRepresentationBuilder builder, it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<ModifiableDBIDs> clusters, DistanceQuery<O> dq, double[] bestd, int[] besti, int x, int y)
size
- size of data setmat
- Matrix paradigmprots
- the prototypes of merges between clustersbuilder
- Result builderclusters
- the current clusteringdq
- the range querybestd
- the distances to the nearest neighboring clusterbesti
- the nearest neighboring clusterx
- first cluster to merge, with x > y
y
- second cluster to merge, with y < x
private void updateMatrices(int size, MatrixParadigm mat, DBIDArrayMIter prots, PointerHierarchyRepresentationBuilder builder, it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<ModifiableDBIDs> clusters, DistanceQuery<O> dq, double[] bestd, int[] besti, int x, int y)
size
- size of data setmat
- matrix viewprots
- the prototypes of merges between clustersbuilder
- Result builderclusters
- the current clusteringdq
- the range querybestd
- the distances to the nearest neighboring clusterbesti
- the nearest neighboring clusterx
- first cluster to merge, with x > y
y
- second cluster to merge, with y < x
private void updateCache(int size, double[] scratch, double[] bestd, int[] besti, int x, int y, int j, double d)
size
- Working set sizescratch
- Scratch matrixbestd
- Best distancebesti
- Best indexx
- First clustery
- Second cluster, y < x
j
- Updated value d(y, j)d
- New distanceprotected void findBest(int size, double[] scratch, double[] bestd, int[] besti, int j)
public TypeInformation[] getInputTypeRestriction()
AbstractAlgorithm
getInputTypeRestriction
in interface Algorithm
getInputTypeRestriction
in class AbstractAlgorithm<PointerHierarchyRepresentationResult>
protected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<PointerHierarchyRepresentationResult>
Copyright © 2019 ELKI Development Team. License information.