O
- Object type@Reference(authors="L. Kaufman and P. J. Rousseeuw", title="Agglomerative Nesting (Program AGNES)", booktitle="Finding Groups in Data: An Introduction to Cluster Analysis", url="http://dx.doi.org/10.1002/9780470316801.ch5") @Alias(value={"HAC","NaiveAgglomerativeHierarchicalClustering","de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.NaiveAgglomerativeHierarchicalClustering"}) public class AGNES<O> extends AbstractDistanceBasedAlgorithm<O,PointerHierarchyRepresentationResult> implements HierarchicalClusteringAlgorithm
SLINK
for a much faster
algorithm (however, only for single-linkage).
This implementation uses the pointer-based representation used by SLINK, so
that the extraction algorithms we have can be used with either of them.
The algorithm is believed to be first published (for single-linkage) by:
P. H. Sneath
The application of computers to taxonomy
Journal of general microbiology, 17(1).
L. Kaufman and P. J. Rousseeuw
Agglomerative Nesting (Program AGNES),
in Finding Groups in Data: An Introduction to Cluster Analysis
G. N. Lance and W. T. Williams
A general theory of classificatory sorting strategies 1. Hierarchical systems
The computer journal 9.4 (1967): 373-380.
R. M. Cormack
A Review of Classification
Journal of the Royal Statistical Society. Series A, Vol. 134, No. 3
Modifier and Type | Class and Description |
---|---|
static class |
AGNES.Parameterizer<O>
Parameterization class
|
Modifier and Type | Field and Description |
---|---|
static Void |
ADDITIONAL_REFERENCE
Additional historical reference for single-linkage.
|
(package private) LinkageMethod |
linkage
Current linkage method in use.
|
private static Logging |
LOG
Class logger
|
DISTANCE_FUNCTION_ID
Constructor and Description |
---|
AGNES(DistanceFunction<? super O> distanceFunction,
LinkageMethod linkage)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected int |
findMerge(int size,
double[] scratch,
DBIDArrayIter ix,
DBIDArrayIter iy,
WritableDBIDDataStore pi,
WritableDoubleDataStore lambda,
WritableIntegerDataStore csize)
Perform the next merge step in AGNES.
|
TypeInformation[] |
getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.
|
protected Logging |
getLogger()
Get the (STATIC) logger for this class.
|
protected static <O> void |
initializeDistanceMatrix(double[] scratch,
DistanceQuery<O> dq,
DBIDArrayIter ix,
DBIDArrayIter iy,
boolean square)
Initialize a distance matrix.
|
protected void |
merge(int size,
double[] scratch,
DBIDArrayIter ix,
DBIDArrayIter iy,
WritableDBIDDataStore pi,
WritableDoubleDataStore lambda,
WritableIntegerDataStore csize,
double mindist,
int x,
int y)
Execute the cluster merge.
|
PointerHierarchyRepresentationResult |
run(Database db,
Relation<O> relation)
Run the algorithm
|
protected static int |
triangleSize(int x)
Compute the size of a complete x by x triangle (minus diagonal)
|
protected void |
updateMatrix(int size,
double[] scratch,
DBIDArrayIter ij,
WritableDoubleDataStore lambda,
WritableIntegerDataStore csize,
double mindist,
int x,
int y,
int sizex,
int sizey)
Update the scratch distance matrix.
|
getDistanceFunction
makeParameterDistanceFunction, run
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run
private static final Logging LOG
LinkageMethod linkage
@Reference(authors="P. H. Sneath", title="The application of computers to taxonomy", booktitle="Journal of general microbiology, 17(1)", url="http://dx.doi.org/10.1099/00221287-17-1-201") public static final Void ADDITIONAL_REFERENCE
public AGNES(DistanceFunction<? super O> distanceFunction, LinkageMethod linkage)
distanceFunction
- Distance function to uselinkage
- Linkage methodpublic PointerHierarchyRepresentationResult run(Database db, Relation<O> relation)
db
- Databaserelation
- Relationprotected static int triangleSize(int x)
x
- Offsetprotected static <O> void initializeDistanceMatrix(double[] scratch, DistanceQuery<O> dq, DBIDArrayIter ix, DBIDArrayIter iy, boolean square)
scratch
- Scratch space to be used.dq
- Distance queryix
- Data iteratoriy
- Data iteratorsquare
- Flag to use squared distances.protected int findMerge(int size, double[] scratch, DBIDArrayIter ix, DBIDArrayIter iy, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableIntegerDataStore csize)
size
- Data set sizescratch
- Scratch space.ix
- First iteratoriy
- Second iteratorpi
- Parent storagelambda
- Lambda (join distance) storagecsize
- Cluster sizesprotected void merge(int size, double[] scratch, DBIDArrayIter ix, DBIDArrayIter iy, WritableDBIDDataStore pi, WritableDoubleDataStore lambda, WritableIntegerDataStore csize, double mindist, int x, int y)
size
- Data set sizescratch
- Scratch space.ix
- First iteratoriy
- Second iteratorpi
- Parent storagelambda
- Lambda (join distance) storagecsize
- Cluster sizesmindist
- Distance that was used for mergingx
- First matrix positiony
- Second matrix positionprotected void updateMatrix(int size, double[] scratch, DBIDArrayIter ij, WritableDoubleDataStore lambda, WritableIntegerDataStore csize, double mindist, int x, int y, int sizex, int sizey)
size
- Data set sizescratch
- Scratch matrix.ij
- Iterator to reuselambda
- Lambda (join distance) storagecsize
- Cluster sizesmindist
- Distance that was used for mergingx
- First matrix positiony
- Second matrix positionsizex
- Old size of first clustersizey
- Old size of second clusterpublic TypeInformation[] getInputTypeRestriction()
AbstractAlgorithm
getInputTypeRestriction
in interface Algorithm
getInputTypeRestriction
in class AbstractAlgorithm<PointerHierarchyRepresentationResult>
protected Logging getLogger()
AbstractAlgorithm
getLogger
in class AbstractAlgorithm<PointerHierarchyRepresentationResult>
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.