tutorial.clustering

## Class NaiveAgglomerativeHierarchicalClustering3<O>

• Type Parameters:
O - Object type
All Implemented Interfaces:
Algorithm, DistanceBasedAlgorithm<O>

@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 AbstractDistanceBasedAlgorithm<O,Result>
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 SLINK for 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
• ### Method Summary

All Methods
Modifier and Type Method and Description
TypeInformation[] getInputTypeRestriction()
Get the input type restriction used for negotiating the data query.
protected Logging getLogger()
Get the (STATIC) logger for this class.
Result 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)
• ### Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractDistanceBasedAlgorithm

getDistanceFunction

run
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

run
• ### Field Detail

• #### LOG

private static final Logging LOG
Class logger
• #### numclusters

int numclusters
Threshold, how many clusters to extract.
• ### Constructor Detail

• #### NaiveAgglomerativeHierarchicalClustering3

public NaiveAgglomerativeHierarchicalClustering3(DistanceFunction<? super O> distanceFunction,
int numclusters,
Constructor.
Parameters:
distanceFunction - Distance function to use
numclusters - Number of clusters
• ### Method Detail

• #### run

public Result run(Database db,
Relation<O> relation)
Run the algorithm
Parameters:
db - Database
relation - Relation
Returns:
Clustering hierarchy
• #### 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