O - Object type@Reference(authors="L. Kaufman, P. J. Rousseeuw",title="Agglomerative Nesting (Program AGNES)",booktitle="Finding Groups in Data: An Introduction to Cluster Analysis",url="https://doi.org/10.1002/9780470316801.ch5",bibkey="doi:10.1002/9780470316801.ch5") @Reference(authors="P. H. Sneath",title="The application of computers to taxonomy",booktitle="Journal of general microbiology, 17(1)",url="https://doi.org/10.1099/00221287-17-1-201",bibkey="doi:10.1099/00221287-17-1-201") @Reference(authors="R. M. Cormack",title="A Review of Classification",booktitle="Journal of the Royal Statistical Society. Series A, Vol. 134, No. 3",url="https://doi.org/10.2307/2344237",bibkey="doi:10.2307/2344237") @Alias(value={"HAC","NaiveAgglomerativeHierarchicalClustering","de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.NaiveAgglomerativeHierarchicalClustering"}) public class AGNES<O> extends AbstractDistanceBasedAlgorithm<O,PointerHierarchyRepresentationResult> implements HierarchicalClusteringAlgorithm
This is the naive O(n³) algorithm. See 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).
This algorithm is also known as AGNES (Agglomerative Nesting), where the use of alternative linkage criterions is discussed:
L. Kaufman, P. J. Rousseeuw
Agglomerative Nesting (Program AGNES),
in Finding Groups in Data: An Introduction to Cluster Analysis
Reference for the unified concept:
G. N. Lance, W. T. Williams
A general theory of classificatory sorting strategies 1. Hierarchical
systems
The computer journal 9.4 (1967): 373-380.
See also:
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 |
|---|---|
(package private) Linkage |
linkage
Current linkage method in use.
|
private static Logging |
LOG
Class logger
|
ALGORITHM_IDDISTANCE_FUNCTION_ID| Constructor and Description |
|---|
AGNES(DistanceFunction<? super O> distanceFunction,
Linkage linkage)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
findMerge(int end,
MatrixParadigm mat,
PointerHierarchyRepresentationBuilder builder)
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 void |
initializeDistanceMatrix(MatrixParadigm mat,
DistanceQuery<?> dq,
Linkage linkage)
Initialize a distance matrix.
|
protected void |
merge(int end,
MatrixParadigm mat,
PointerHierarchyRepresentationBuilder builder,
double mindist,
int x,
int y)
Execute the cluster merge.
|
PointerHierarchyRepresentationResult |
run(Database db,
Relation<O> relation)
Run the algorithm
|
protected static int |
shrinkActiveSet(DBIDArrayIter ix,
PointerHierarchyRepresentationBuilder builder,
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(int end,
MatrixParadigm mat,
PointerHierarchyRepresentationBuilder builder,
double mindist,
int x,
int y,
int sizex,
int sizey)
Update the scratch distance matrix.
|
getDistanceFunctionrunclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrunprivate static final Logging LOG
Linkage linkage
public AGNES(DistanceFunction<? super O> distanceFunction, Linkage linkage)
distanceFunction - Distance function to uselinkage - Linkage methodpublic PointerHierarchyRepresentationResult run(Database db, Relation<O> relation)
db - Databaserelation - Relationprotected static int shrinkActiveSet(DBIDArrayIter ix, PointerHierarchyRepresentationBuilder builder, int end, int x)
ix - Object iteratorbuilder - Builder to detect merged statusend - Current active set sizex - Last merged objectprotected static void initializeDistanceMatrix(MatrixParadigm mat, DistanceQuery<?> dq, Linkage linkage)
mat - Matrixdq - Distance querylinkage - Linkage methodprotected int findMerge(int end,
MatrixParadigm mat,
PointerHierarchyRepresentationBuilder builder)
end - Active set sizemat - Matrix storagebuilder - Pointer representation builderprotected void merge(int end,
MatrixParadigm mat,
PointerHierarchyRepresentationBuilder builder,
double mindist,
int x,
int y)
end - Active set sizemat - Matrix paradigmbuilder - Hierarchy buildermindist - Distance that was used for mergingx - First matrix positiony - Second matrix positionprotected void updateMatrix(int end,
MatrixParadigm mat,
PointerHierarchyRepresentationBuilder builder,
double mindist,
int x,
int y,
int sizex,
int sizey)
end - Active set sizemat - Matrix viewbuilder - Hierarchy builder (to get cluster sizes)mindist - Distance that was used for mergingx - First matrix positiony - Second matrix positionsizex - Old size of first clustersizey - Old size of second clusterpublic TypeInformation[] getInputTypeRestriction()
AbstractAlgorithmgetInputTypeRestriction in interface AlgorithmgetInputTypeRestriction in class AbstractAlgorithm<PointerHierarchyRepresentationResult>protected Logging getLogger()
AbstractAlgorithmgetLogger in class AbstractAlgorithm<PointerHierarchyRepresentationResult>Copyright © 2019 ELKI Development Team. License information.