NlpTools API
Class

NlpTools\Clustering\MergeStrategies\CompleteLink

class CompleteLink extends HeapLinkage

In single linkage clustering the new distance of the merged cluster with cluster i is the maximum distance of either cluster x to i or y to i.

For a more detailed description see the documentation of SingleLink.

Methods

initializeStrategy(DistanceInterface $d, array $docs)

Initialize the distance matrix and any other data structure needed to calculate the merges later.

from HeapLinkage
array getNextMerge()

Return the pair of clusters x,y to be merged.

from HeapLinkage

Details

in HeapLinkage at line 44
public initializeStrategy(DistanceInterface $d, array $docs)

Initialize the distance matrix and any other data structure needed to calculate the merges later.

Parameters

DistanceInterface $d The distance metric used to calculate the distance matrix
array $docs The docs to be clustered

in HeapLinkage at line 78
public array getNextMerge()

Return the pair of clusters x,y to be merged.

1. Extract the pair with the smallest distance
2. Recalculate the distance of the merged cluster with every other cluster
3. Merge the clusters (by labeling one as removed)
4. Reheap

Return Value

array The pair (x,y) to be merged