Package nltk :: Package cluster :: Module util :: Class VectorSpace
[hide private]
[frames] | no frames]

Class VectorSpace

source code

api.ClusterI --+
               |
              VectorSpace
Known Subclasses:

Abstract clusterer which takes tokens and maps them into a vector space. Optionally performs singular value decomposition to reduce the dimensionality.

Instance Methods [hide private]
 
__init__(self, normalise=False, svd_dimensions=None) source code
 
cluster(self, vectors, assign_clusters=False, trace=False)
Assigns the vectors to clusters, learning the clustering parameters from the data.
source code
 
cluster_vectorspace(self, vectors, trace)
Finds the clusters using the given set of vectors.
source code
 
classify(self, vector)
Classifies the token into a cluster, setting the token's CLUSTER parameter to that cluster identifier.
source code
 
classify_vectorspace(self, vector)
Returns the index of the appropriate cluster for the vector.
source code
 
likelihood(self, vector, label)
Returns the likelihood (a float) of the token having the corresponding cluster.
source code
 
likelihood_vectorspace(self, vector, cluster)
Returns the likelihood of the vector belonging to the cluster.
source code
 
vector(self, vector)
Returns the vector after normalisation and dimensionality reduction
source code
 
_normalise(self, vector)
Normalises the vector to unit length.
source code

Inherited from api.ClusterI: classification_probdist, cluster_name, cluster_names, num_clusters

Method Details [hide private]

__init__(self, normalise=False, svd_dimensions=None)
(Constructor)

source code 
Parameters:
  • normalise (boolean) - should vectors be normalised to length 1
  • svd_dimensions (int) - number of dimensions to use in reducing vector dimensionsionality with SVD

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

source code 

Assigns the vectors to clusters, learning the clustering parameters from the data. Returns a cluster identifier for each vector.

Overrides: api.ClusterI.cluster
(inherited documentation)

classify(self, vector)

source code 

Classifies the token into a cluster, setting the token's CLUSTER parameter to that cluster identifier.

Overrides: api.ClusterI.classify
(inherited documentation)

likelihood(self, vector, label)

source code 

Returns the likelihood (a float) of the token having the corresponding cluster.

Overrides: api.ClusterI.likelihood
(inherited documentation)