|
Darwin
1.10(beta)
|
Implements a multi-variant Gaussian mixture model. More...
Public Member Functions | |
| drwnGaussianMixture (unsigned n=1, unsigned k=1) | |
construct a gaussian mixture model over n dimensional features with k mixture components | |
| void | initialize (unsigned n, unsigned k) |
initialize the gaussian mixture model to be over n dimensional features with k mixture components | |
| const char * | type () const |
| returns object type as a string (e.g., Foo::type() { return "Foo"; }) | |
| drwnGaussianMixture * | clone () const |
| returns a copy of the class usually implemented as virtual Foo* clone() { return new Foo(*this); } | |
| bool | save (drwnXMLNode &xml) const |
| write object to XML node (see also write) | |
| bool | load (drwnXMLNode &xml) |
| read object from XML node (see also read) | |
| void | evaluate (const MatrixXd &x, VectorXd &p) const |
compute the log-likelihood of each row of x and put the results in p | |
| void | evaluate (const vector< vector< double > > &x, vector< double > &p) const |
compute the log-likelihood of each vector in x and put the results in p | |
| double | evaluateSingle (const VectorXd &x) const |
| compute the log-likelihood of a given vector | |
| double | evaluateSingle (const vector< double > &x) const |
| compute the log-likelihood of a given vector | |
| void | sample (VectorXd &x) const |
| generate a random sample from the mixture of gaussian distribution | |
| void | sample (vector< double > &x) const |
| generate a random sample from the mixture of gaussian distribution | |
| void | train (const MatrixXd &x, double lambda=1.0e-3) |
Estimate the parameters of the mixture of gaussians from a matrix of training examples using the EM algorithm. The parameter lambda regularizes the component covariance matrices towards the global covariance matrix. | |
| void | train (const vector< vector< double > > &x, double lambda=1.0e-3) |
| See above. | |
| unsigned | mixtures () const |
| returns the number of mixture components | |
| unsigned | dimension () const |
| returns the dimensionality of the features space | |
| double | weight (int k) const |
returns the mixture weight of the k-th component | |
| const VectorXd & | mean (int k) const |
returns the mean of the k-th component | |
| const MatrixXd & | covariance (int k) const |
returns the covariance matrix for the k-th component | |
| const drwnGaussian & | component (int k) const |
returns the k-th component as a gaussian distribution | |
| drwnGaussianMixture & | operator= (const drwnGaussianMixture &model) |
| assignment operator | |
Public Member Functions inherited from drwnWriteable | |
| bool | write (const char *filename) const |
| write object to file (calls save) | |
| bool | read (const char *filename) |
| read object from file (calls load) | |
| void | dump () const |
| print object's current state to standard output (for debugging) | |
Static Public Attributes | |
| static int | MAX_ITERATIONS = 100 |
Protected Attributes | |
| unsigned | _n |
| feature dimension | |
| vector< drwnGaussian > | _g |
| gaussian components | |
| VectorXd | _logLambda |
| mixture weights (log space) | |
Implements a multi-variant Gaussian mixture model.
The following code snippet shows example usage:
1.8.6