class EMClusterer(VectorSpaceClusterer): (source)
Constructor: EMClusterer(initial_means, priors, covariance_matrices, conv_threshold, ...)
The Gaussian EM clusterer models the vectors as being produced by a mixture of k Gaussian sources. The parameters of these sources (prior probability, mean and covariance matrix) are then found to maximise the likelihood of the given data. This is done with the expectation maximisation algorithm. It starts with k arbitrarily chosen means, priors and covariance matrices. It then calculates the membership probabilities for each vector in each of the clusters; this is the 'E' step. The cluster parameters are then updated in the 'M' step using the maximum likelihood estimate from the cluster membership probabilities. This process continues until the likelihood of the data does not significantly increase.
Method | __init__ |
Creates an EM clusterer with the given starting parameters, convergence threshold and vector mangling parameters. |
Method | __repr__ |
Undocumented |
Method | classify |
Returns the index of the appropriate cluster for the vector. |
Method | cluster |
Finds the clusters using the given set of vectors. |
Method | likelihood |
Returns the likelihood of the vector belonging to the cluster. |
Method | num |
Returns the number of clusters. |
Method | _gaussian |
Undocumented |
Method | _loglikelihood |
Undocumented |
Instance Variable | _bias |
Undocumented |
Instance Variable | _conv |
Undocumented |
Instance Variable | _covariance |
Undocumented |
Instance Variable | _means |
Undocumented |
Instance Variable | _num |
Undocumented |
Instance Variable | _priors |
Undocumented |
Inherited from VectorSpaceClusterer
:
Method | classify |
Classifies the token into a cluster, setting the token's CLUSTER parameter to that cluster identifier. |
Method | cluster |
Assigns the vectors to clusters, learning the clustering parameters from the data. Returns a cluster identifier for each vector. |
Method | likelihood |
Returns the likelihood (a float) of the token having the corresponding 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
(via VectorSpaceClusterer
):
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 |
Creates an EM clusterer with the given starting parameters, convergence threshold and vector mangling parameters.
Parameters | |
initial | the means of the gaussian cluster centers |
priors:numpy array or seq of float | the prior probability for each cluster |
covariance | the covariance matrix for each cluster |
conv | maximum change in likelihood before deemed convergent |
bias:float | variance bias used to ensure non-singular covariance matrices |
normalise:boolean | should vectors be normalised to length 1 |
svd | number of dimensions to use in reducing vector dimensionsionality with SVD |