NlpTools API
Class

NlpTools\Clustering\Hierarchical

class Hierarchical extends Clusterer

This class implements hierarchical agglomerative clustering.

It receives a MergeStrategy as a parameter and a Distance metric.

Methods

array cluster(TrainingSet $documents, FeatureFactoryInterface $ff)

Group the documents together

__construct(MergeStrategyInterface $ms, DistanceInterface $d)

static array dendrogramToClusters(array $tree, integer $NC)

Flatten a dendrogram to an almost specific number of clusters (the closest power of 2 larger than $NC)

Details

at line 32
public array cluster(TrainingSet $documents, FeatureFactoryInterface $ff)

Group the documents together

Parameters

TrainingSet $documents The documents to be clustered
FeatureFactoryInterface $ff A feature factory to transform the documents given

Return Value

array An array containing one element which is the resulting dendrogram

at line 19
public __construct(MergeStrategyInterface $ms, DistanceInterface $d)

at line 68
static public array dendrogramToClusters(array $tree, integer $NC)

Flatten a dendrogram to an almost specific number of clusters (the closest power of 2 larger than $NC)

Parameters

array $tree The dendrogram to be flattened
integer $NC The number of clusters to cut to

Return Value

array The flat clusters