class VectorSpaceClusterer(ClusterI): (source)
Known subclasses: nltk.cluster.em.EMClusterer
, nltk.cluster.gaac.GAAClusterer
, nltk.cluster.kmeans.KMeansClusterer
Constructor: VectorSpaceClusterer(normalise, svd_dimensions)
Abstract clusterer which takes tokens and maps them into a vector space. Optionally performs singular value decomposition to reduce the dimensionality.
Method | __init__ |
No summary |
Method | classify |
Classifies the token into a cluster, setting the token's CLUSTER parameter to that cluster identifier. |
Method | classify |
Returns the index of the appropriate cluster for the vector. |
Method | cluster |
Assigns the vectors to clusters, learning the clustering parameters from the data. Returns a cluster identifier for each vector. |
Method | cluster |
Finds the clusters using the given set of vectors. |
Method | likelihood |
Returns the likelihood (a float) of the token having the corresponding cluster. |
Method | likelihood |
Returns the likelihood of the vector belonging to the cluster. |
Method | vector |
Returns the vector after normalisation and dimensionality reduction |
Method | _normalise |
Normalises the vector to unit length. |
Instance Variable | _should |
Undocumented |
Instance Variable | _svd |
Undocumented |
Instance Variable | _ |
Undocumented |
Inherited from ClusterI
:
Method | classification |
Classifies the token into a cluster, returning a probability distribution over the cluster identifiers. |
Method | cluster |
Returns the names of the cluster at index. |
Method | cluster |
Returns the names of the clusters. :rtype: list |
Method | num |
Returns the number of clusters. |
nltk.cluster.em.EMClusterer
, nltk.cluster.gaac.GAAClusterer
, nltk.cluster.kmeans.KMeansClusterer
Parameters | |
normalise:boolean | should vectors be normalised to length 1 |
svd | number of dimensions to use in reducing vector dimensionsionality with SVD |
nltk.cluster.api.ClusterI.classify
Classifies the token into a cluster, setting the token's CLUSTER parameter to that cluster identifier.
nltk.cluster.em.EMClusterer
, nltk.cluster.gaac.GAAClusterer
, nltk.cluster.kmeans.KMeansClusterer
Returns the index of the appropriate cluster for the vector.
nltk.cluster.api.ClusterI.cluster
nltk.cluster.gaac.GAAClusterer
Assigns the vectors to clusters, learning the clustering parameters from the data. Returns a cluster identifier for each vector.
nltk.cluster.em.EMClusterer
, nltk.cluster.gaac.GAAClusterer
, nltk.cluster.kmeans.KMeansClusterer
Finds the clusters using the given set of vectors.
nltk.cluster.api.ClusterI.likelihood
Returns the likelihood (a float) of the token having the corresponding cluster.
nltk.cluster.em.EMClusterer
Returns the likelihood of the vector belonging to the cluster.