Package nltk :: Package cluster :: Module gaac :: Class GroupAverageAgglomerative
[hide private]
[frames] | no frames]

Class GroupAverageAgglomerative

source code

api.ClusterI --+    
               |    
util.VectorSpace --+
                   |
                  GroupAverageAgglomerative

The GAAC clusterer starts with each of the N vectors as singleton clusters. It then iteratively merges pairs of clusters which have the closest centroids. This continues until there is only one cluster. The order of merges gives rise to a dendogram: a tree with the earlier merges lower than later merges. The membership of a given number of clusters c, 1 <= c <= N, can be found by cutting the dendogram at depth c.

This clusterer uses the cosine similarity metric only, which allows for efficient speed-up in the clustering process.

Instance Methods [hide private]
 
__init__(self, num_clusters=1, normalise=True, svd_dimensions=None) source code
 
cluster(self, vectors, assign_clusters=False, trace=False) source code
 
cluster_vectorspace(self, vectors, trace=False)
Finds the clusters using the given set of vectors.
source code
 
update_clusters(self, num_clusters) source code
 
classify_vectorspace(self, vector)
Returns the index of the appropriate cluster for the vector.
source code
Dendogram
dendogram(self)
Returns: The dendogram representing the current clustering
source code
 
num_clusters(self)
Returns the number of clusters.
source code
 
_average_similarity(self, v1, l1, v2, l2) source code
 
__repr__(self) source code

Inherited from util.VectorSpace: classify, likelihood, likelihood_vectorspace, vector

Inherited from util.VectorSpace (private): _normalise

Inherited from api.ClusterI: classification_probdist, cluster_name, cluster_names

Method Details [hide private]

__init__(self, num_clusters=1, normalise=True, svd_dimensions=None)
(Constructor)

source code 
Parameters:
  • normalise - should vectors be normalised to length 1
  • svd_dimensions - number of dimensions to use in reducing vector dimensionsionality with SVD
Overrides: util.VectorSpace.__init__
(inherited documentation)

cluster(self, vectors, assign_clusters=False, trace=False)

source code 
Overrides: util.VectorSpace.cluster

cluster_vectorspace(self, vectors, trace=False)

source code 

Finds the clusters using the given set of vectors.

Overrides: util.VectorSpace.cluster_vectorspace
(inherited documentation)

classify_vectorspace(self, vector)

source code 

Returns the index of the appropriate cluster for the vector.

Overrides: util.VectorSpace.classify_vectorspace
(inherited documentation)

dendogram(self)

source code 
Returns: Dendogram
The dendogram representing the current clustering

num_clusters(self)

source code 

Returns the number of clusters.

Overrides: api.ClusterI.num_clusters
(inherited documentation)