MLPACK  1.0.4
Public Member Functions | Private Member Functions | Private Attributes
mlpack::gmm::EMFit< InitialClusteringType > Class Template Reference

This class contains methods which can fit a GMM to observations using the EM algorithm. More...

List of all members.

Public Member Functions

 EMFit (InitialClusteringType clusterer=InitialClusteringType())
 Construct the EMFit object, optionally passing an InitialClusteringType object (just in case it needs to store state).
void Estimate (const arma::mat &observations, std::vector< arma::vec > &means, std::vector< arma::mat > &covariances, arma::vec &weights)
 Fit the observations to a Gaussian mixture model (GMM) using the EM algorithm.
void Estimate (const arma::mat &observations, const arma::vec &probabilities, std::vector< arma::vec > &means, std::vector< arma::mat > &covariances, arma::vec &weights)
 Fit the observations to a Gaussian mixture model (GMM) using the EM algorithm, taking into account the probabilities of each point being from this mixture.

Private Member Functions

void InitialClustering (const arma::mat &observations, std::vector< arma::vec > &means, std::vector< arma::mat > &covariances, arma::vec &weights)
 Run the clusterer, and then turn the cluster assignments into Gaussians.
double LogLikelihood (const arma::mat &data, const std::vector< arma::vec > &means, const std::vector< arma::mat > &covariances, const arma::vec &weights) const
 Calculate the log-likelihood of a model.

Private Attributes

InitialClusteringType clusterer

Detailed Description

template<typename InitialClusteringType = kmeans::KMeans<>>
class mlpack::gmm::EMFit< InitialClusteringType >

This class contains methods which can fit a GMM to observations using the EM algorithm.

It requires an initial clustering mechanism, which is by default the KMeans algorithm. The clustering mechanism must implement the following method:

This method should create 'clusters' clusters, and return the assignment of each point to a cluster.

Definition at line 48 of file em_fit.hpp.


Constructor & Destructor Documentation

template<typename InitialClusteringType = kmeans::KMeans<>>
mlpack::gmm::EMFit< InitialClusteringType >::EMFit ( InitialClusteringType  clusterer = InitialClusteringType()) [inline]

Construct the EMFit object, optionally passing an InitialClusteringType object (just in case it needs to store state).

Definition at line 55 of file em_fit.hpp.


Member Function Documentation

template<typename InitialClusteringType = kmeans::KMeans<>>
void mlpack::gmm::EMFit< InitialClusteringType >::Estimate ( const arma::mat &  observations,
std::vector< arma::vec > &  means,
std::vector< arma::mat > &  covariances,
arma::vec &  weights 
)

Fit the observations to a Gaussian mixture model (GMM) using the EM algorithm.

The size of the vectors (indicating the number of components) must already be set.

Parameters:
observationsList of observations to train on.
meansVector to store trained means in.
covariancesVector to store trained covariances in.
weightsVector to store a priori weights in.
template<typename InitialClusteringType = kmeans::KMeans<>>
void mlpack::gmm::EMFit< InitialClusteringType >::Estimate ( const arma::mat &  observations,
const arma::vec &  probabilities,
std::vector< arma::vec > &  means,
std::vector< arma::mat > &  covariances,
arma::vec &  weights 
)

Fit the observations to a Gaussian mixture model (GMM) using the EM algorithm, taking into account the probabilities of each point being from this mixture.

The size of the vectors (indicating the number of components) must already be set.

Parameters:
observationsList of observations to train on.
probabilitiesProbability of each point being from this model.
meansVector to store trained means in.
covariancesVector to store trained covariances in.
weightsVector to store a priori weights in.
template<typename InitialClusteringType = kmeans::KMeans<>>
void mlpack::gmm::EMFit< InitialClusteringType >::InitialClustering ( const arma::mat &  observations,
std::vector< arma::vec > &  means,
std::vector< arma::mat > &  covariances,
arma::vec &  weights 
) [private]

Run the clusterer, and then turn the cluster assignments into Gaussians.

This is a helper function for both overloads of Estimate(). The vectors must be already set to the number of clusters.

Parameters:
observationsList of observations.
meansVector to store means in.
covariancesVector to store covariances in.
weightsVector to store a priori weights in.
template<typename InitialClusteringType = kmeans::KMeans<>>
double mlpack::gmm::EMFit< InitialClusteringType >::LogLikelihood ( const arma::mat &  data,
const std::vector< arma::vec > &  means,
const std::vector< arma::mat > &  covariances,
const arma::vec &  weights 
) const [private]

Calculate the log-likelihood of a model.

Yes, this is reimplemented in the GMM code. Intuition suggests that the log-likelihood is not the best way to determine if the EM algorithm has converged.

Parameters:
dataData matrix.
meansVector of means.
covariancesVector of covariance matrices.
weightsVector of a priori weights.

Member Data Documentation

template<typename InitialClusteringType = kmeans::KMeans<>>
InitialClusteringType mlpack::gmm::EMFit< InitialClusteringType >::clusterer [private]

Definition at line 122 of file em_fit.hpp.


The documentation for this class was generated from the following file: