Package tutorial.clustering
Class NaiveAgglomerativeHierarchicalClustering3<O>
- java.lang.Object
-
- tutorial.clustering.NaiveAgglomerativeHierarchicalClustering3<O>
-
- Type Parameters:
O- Object type
- All Implemented Interfaces:
Algorithm
@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") public class NaiveAgglomerativeHierarchicalClustering3<O> extends java.lang.Object implements Algorithm
This tutorial will step you through implementing a well known clustering algorithm, agglomerative hierarchical clustering, in multiple steps.This is the third step, where we add support for different linkage strategies.
This is the naive O(n³) algorithm. See
SLINKfor a much faster algorithm (however, only for single-linkage).Reference (for the update formulas):
R. M. Cormack
A Review of Classification
Journal of the Royal Statistical Society. Series A, Vol. 134, No. 3- Since:
- 0.6.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNaiveAgglomerativeHierarchicalClustering3.LinkageDifferent linkage strategies.-
Nested classes/interfaces inherited from interface elki.Algorithm
Algorithm.Utils
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Distance<? super O>distanceDistance function used.(package private) NaiveAgglomerativeHierarchicalClustering3.LinkagelinkageCurrent linkage in use.private static LoggingLOGClass logger(package private) intnumclustersThreshold, how many clusters to extract.
-
Constructor Summary
Constructors Constructor Description NaiveAgglomerativeHierarchicalClustering3(Distance<? super O> distance, int numclusters, NaiveAgglomerativeHierarchicalClustering3.Linkage linkage)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeInformation[]getInputTypeRestriction()Get the input type restriction used for negotiating the data query.Clustering<Model>run(Relation<O> relation)Perform HACprotected static inttriangleSize(int x)Compute the size of a complete x by x triangle (minus diagonal)
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger
-
numclusters
int numclusters
Threshold, how many clusters to extract.
-
linkage
NaiveAgglomerativeHierarchicalClustering3.Linkage linkage
Current linkage in use.
-
-
Constructor Detail
-
NaiveAgglomerativeHierarchicalClustering3
public NaiveAgglomerativeHierarchicalClustering3(Distance<? super O> distance, int numclusters, NaiveAgglomerativeHierarchicalClustering3.Linkage linkage)
Constructor.- Parameters:
distance- Distance function to usenumclusters- Number of clusterslinkage- Linkage strategy
-
-
Method Detail
-
getInputTypeRestriction
public TypeInformation[] getInputTypeRestriction()
Description copied from interface:AlgorithmGet the input type restriction used for negotiating the data query.- Specified by:
getInputTypeRestrictionin interfaceAlgorithm- Returns:
- Type restriction
-
run
public Clustering<Model> run(Relation<O> relation)
Perform HAC- Parameters:
relation- Data relation- Returns:
- Clustering
-
triangleSize
protected static int triangleSize(int x)
Compute the size of a complete x by x triangle (minus diagonal)- Parameters:
x- Offset- Returns:
- Size of complete triangle
-
-