A Gaussian mixture model class. More...
Public Member Functions | |
index_t | dimension () |
void | Display () |
This function prints the parameters of the model. | |
void | ExpectationMaximization (Matrix &data_points) |
This function calculates the parameters of the model using the Maximum Likelihood function via the Expectation Maximization (EM) Algorithm. | |
void | Init (datanode *mog_em_module) |
void | Init (index_t num_gauss, index_t dimension) |
void | KMeans (Matrix &data, ArrayList< Vector > *means, ArrayList< Matrix > *covars, Vector *weights, index_t value_of_k) |
This function computes the k-means of the data and stores the calculated means and covariances in the ArrayList of Vectors and Matrices passed to it. | |
long double | Loglikelihood (Matrix &data_points, ArrayList< Vector > &means, ArrayList< Matrix > &covars, Vector &weights) |
This function computes the loglikelihood of model. | |
Vector & | mu (index_t i) |
ArrayList< Vector > & | mu () |
index_t | number_of_gaussians () |
double | omega (index_t i) |
Vector & | omega () |
void | OutputResults (ArrayList< double > *results) |
This function outputs the parameters of the model to an arraylist of doubles. | |
void | set_mu (index_t i, index_t length, const double *mu) |
void | set_mu (index_t i, Vector &mu) |
void | set_omega (index_t length, const double *omega) |
void | set_omega (Vector &omega) |
void | set_sigma (index_t i, Matrix &sigma) |
Matrix & | sigma (index_t i) |
ArrayList< Matrix > & | sigma () |
A Gaussian mixture model class.
This class uses maximum likelihood loss functions to estimate the parameters of a gaussian mixture model on a given data via the EM algorithm.
Example use:
MoGEM mog; ArrayList<double> results; mog.Init(number_of_gaussians, dimension); mog.ExpectationMaximization(data, &results, optim_flag);
Definition at line 85 of file mog_em.h.
void MoGEM::Display | ( | ) | [inline] |
void MoGEM::ExpectationMaximization | ( | Matrix & | data_points | ) |
This function calculates the parameters of the model using the Maximum Likelihood function via the Expectation Maximization (EM) Algorithm.
MoG mog; Matrix data = "the data on which you want to fit the model"; ArrayList<double> results; mog.ExpectationMaximization(data, &results);
Definition at line 45 of file mog_em.cc.
References linalg__private::AddExpert(), GenVector< T >::CopyValues(), GenVector< T >::get(), GenMatrix< T >::Init(), GenVector< T >::Init(), ArrayList< TElem >::Init(), KMeans(), Loglikelihood(), linalg__private::MulOverwrite(), linalg__private::Scale(), GenVector< T >::SetAll(), and linalg__private::SubFrom().
void MoGEM::KMeans | ( | Matrix & | data, | |
ArrayList< Vector > * | means, | |||
ArrayList< Matrix > * | covars, | |||
Vector * | weights, | |||
index_t | value_of_k | |||
) |
This function computes the k-means of the data and stores the calculated means and covariances in the ArrayList of Vectors and Matrices passed to it.
It sets the weights uniformly.
This function is used to obtain a starting point for the optimization
Definition at line 202 of file mog_em.cc.
References linalg__private::AddTo(), GenVector< T >::CopyValues(), GenVector< T >::Init(), ArrayList< TElem >::Init(), linalg__private::Scale(), GenVector< T >::SetAll(), and linalg__private::SubOverwrite().
Referenced by ExpectationMaximization().
long double MoGEM::Loglikelihood | ( | Matrix & | data_points, | |
ArrayList< Vector > & | means, | |||
ArrayList< Matrix > & | covars, | |||
Vector & | weights | |||
) |
This function computes the loglikelihood of model.
This function is used by the 'ExpectationMaximization' function.
Definition at line 182 of file mog_em.cc.
References GenVector< T >::CopyValues(), GenVector< T >::get(), and GenVector< T >::Init().
Referenced by ExpectationMaximization().
void MoGEM::OutputResults | ( | ArrayList< double > * | results | ) | [inline] |
This function outputs the parameters of the model to an arraylist of doubles.
ArrayList<double> results; mog.OutputResults(&results);