A Diagonal Gaussian Mixture Model. More...
Public Member Functions  
DiagonalGMM ()  
Create an empty Diagonal Gaussian Mixture Model, with zero gaussians. More...  
DiagonalGMM (const size_t gaussians, const size_t dimensionality)  
Create a GMM with the given number of Gaussians, each of which have the specified dimensionality. More...  
DiagonalGMM (const std::vector< distribution::DiagonalGaussianDistribution > &dists, const arma::vec &weights)  
Create a DiagonalGMM with the given dists and weights. More...  
DiagonalGMM (const DiagonalGMM &other)  
Copy constructor for DiagonalGMMs. More...  
void  Classify (const arma::mat &observations, arma::Row< size_t > &labels) const 
Classify the given observations as being from an individual component in this DiagonalGMM. More...  
const distribution::DiagonalGaussianDistribution &  Component (size_t i) const 
Return a const reference to a component distribution. More...  
distribution::DiagonalGaussianDistribution &  Component (size_t i) 
Return a reference to a component distribution. More...  
size_t  Dimensionality () const 
Return the dimensionality of the model. More...  
size_t  Gaussians () const 
Return the number of Gaussians in the model. More...  
double  LogProbability (const arma::vec &observation) const 
Return the log probability that the given observation came from this distribution. More...  
double  LogProbability (const arma::vec &observation, const size_t component) const 
Return the log probability that the given observation came from the given Gaussian component in this distribution. More...  
DiagonalGMM &  operator= (const DiagonalGMM &other) 
Copy operator for DiagonalGMMs. More...  
double  Probability (const arma::vec &observation) const 
Return the probability that the given observation came from this distribution. More...  
double  Probability (const arma::vec &observation, const size_t component) const 
Return the probability that the given observation came from the given Gaussian component in this distribution. More...  
arma::vec  Random () const 
Return a randomly generated observation according to the probability distribution defined by this object. More...  
template < typename Archive >  
void  serialize (Archive &ar, const unsigned int) 
Serialize the DiagonalGMM. More...  
template<typename FittingType = EMFit<kmeans::KMeans<>, DiagonalConstraint, distribution::DiagonalGaussianDistribution>>  
double  Train (const arma::mat &observations, const size_t trials=1, const bool useExistingModel=false, FittingType fitter=FittingType()) 
Estimate the probability distribution directly from the given observations, using the given algorithm in the FittingType class to fit the data. More...  
template<typename FittingType = EMFit<kmeans::KMeans<>, DiagonalConstraint, distribution::DiagonalGaussianDistribution>>  
double  Train (const arma::mat &observations, const arma::vec &probabilities, const size_t trials=1, const bool useExistingModel=false, FittingType fitter=FittingType()) 
Estimate the probability distribution directly from the given observations, taking into account the probability of each observation actually being from this distribution, and using the given algorithm in the FittingType class to fit the data. More...  
const arma::vec &  Weights () const 
Return a const reference to the a priori weights of each Gaussian. More...  
arma::vec &  Weights () 
Return a reference to the a priori weights of each Gaussian. More...  
A Diagonal Gaussian Mixture Model.
This class uses maximum likelihood loss functions to estimate the parameters of the DiagonalGMM on a given dataset via the given fitting mechanism, defined by the FittingType template parameter. The DiagonalGMM can be trained using normal data, or data with probabilities of being from this GMM (see DiagonalGMM::Train() for more information). The DiagonalGMM is the same as GMM except for wrapping gmm_diag class.
The Train() method uses a template type 'FittingType'. The FittingType template class must provide a way for the DiagonalGMM to train on data. It must provide the following two functions:
Example use:
Definition at line 74 of file diagonal_gmm.hpp.

inline 
Create an empty Diagonal Gaussian Mixture Model, with zero gaussians.
Definition at line 92 of file diagonal_gmm.hpp.
References Log::Debug.
Referenced by DiagonalGMM::DiagonalGMM().
DiagonalGMM  (  const size_t  gaussians, 
const size_t  dimensionality  
) 
Create a GMM with the given number of Gaussians, each of which have the specified dimensionality.
The means and covariances will be set to 0.
gaussians  Number of Gaussians in this DiagonalGMM. 
dimensionality  Dimensionality of each Gaussian. 

inline 
Create a DiagonalGMM with the given dists and weights.
dists  Distributions of the model. 
weights  Weights of the model. 
Definition at line 118 of file diagonal_gmm.hpp.
References DiagonalGMM::DiagonalGMM(), and DiagonalGMM::operator=().
DiagonalGMM  (  const DiagonalGMM &  other  ) 
Copy constructor for DiagonalGMMs.
void Classify  (  const arma::mat &  observations, 
arma::Row< size_t > &  labels  
)  const 
Classify the given observations as being from an individual component in this DiagonalGMM.
The resultant classifications are stored in the 'labels' object, and each label will be between 0 and (Gaussians()  1). Supposing that a point was classified with label 2, and that our DiagonalGMM object was called 'dgmm', one could access the relevant Gaussian distribution as follows:
observations  Matrix of observations to classify. 
labels  Object which will be filled with labels. 
Referenced by DiagonalGMM::Weights().

inline 
Return a const reference to a component distribution.
i  Index of component. 
Definition at line 141 of file diagonal_gmm.hpp.

inline 
Return a reference to a component distribution.
i  Index of component. 
Definition at line 151 of file diagonal_gmm.hpp.

inline 
Return the dimensionality of the model.
Definition at line 134 of file diagonal_gmm.hpp.

inline 
Return the number of Gaussians in the model.
Definition at line 132 of file diagonal_gmm.hpp.
double LogProbability  (  const arma::vec &  observation  )  const 
Return the log probability that the given observation came from this distribution.
observation  Observation to evaluate the probability of. 
Referenced by DiagonalGMM::Weights().
double LogProbability  (  const arma::vec &  observation, 
const size_t  component  
)  const 
Return the log probability that the given observation came from the given Gaussian component in this distribution.
observation  Observation to evaluate the probability of. 
component  Index of the component of the DiagonalGMM. 
DiagonalGMM& operator=  (  const DiagonalGMM &  other  ) 
Copy operator for DiagonalGMMs.
Referenced by DiagonalGMM::DiagonalGMM().
double Probability  (  const arma::vec &  observation  )  const 
Return the probability that the given observation came from this distribution.
observation  Observation to evaluate the probability of. 
Referenced by DiagonalGMM::Weights().
double Probability  (  const arma::vec &  observation, 
const size_t  component  
)  const 
Return the probability that the given observation came from the given Gaussian component in this distribution.
observation  Observation to evaluate the probability of. 
component  Index of the component of the DiagonalGMM. 
arma::vec Random  (  )  const 
Return a randomly generated observation according to the probability distribution defined by this object.
Referenced by DiagonalGMM::Weights().
void serialize  (  Archive &  ar, 
const unsigned  int  
) 
Serialize the DiagonalGMM.
Referenced by DiagonalGMM::Weights().
double Train  (  const arma::mat &  observations, 
const size_t  trials = 1 , 

const bool  useExistingModel = false , 

FittingType  fitter = FittingType() 

) 
Estimate the probability distribution directly from the given observations, using the given algorithm in the FittingType class to fit the data.
The fitting will be performed 'trials' times; from these trials, the model with the greatest loglikelihood will be selected. By default, only one trial is performed. The loglikelihood of the best fitting is returned.
Optionally, the existing model can be used as an initial model for the estimation by setting 'useExistingModel' to true. If the fitting procedure is deterministic after the initial position is given, then 'trials' should be set to 1.
observations  Observations of the model. 
trials  Number of trials to perform; the model in these trials with the greatest loglikelihood will be selected. 
useExistingModel  If true, the existing model is used as an initial model for the estimation. 
fitter  Fitting type that estimates observations. 
Referenced by DiagonalGMM::Weights().
double Train  (  const arma::mat &  observations, 
const arma::vec &  probabilities,  
const size_t  trials = 1 , 

const bool  useExistingModel = false , 

FittingType  fitter = FittingType() 

) 
Estimate the probability distribution directly from the given observations, taking into account the probability of each observation actually being from this distribution, and using the given algorithm in the FittingType class to fit the data.
The fitting will be performed 'trials' times; from these trials, the model with the greatest loglikelihood will be selected. By default, only one trial is performed. The loglikelihood of the best fitting is returned.
Optionally, the existing model can be used as an initial model for the estimation by setting 'useExistingModel' to true. If the fitting procedure is deterministic after the initial position is given, then 'trials' should be set to 1.
observations  Observations of the model. 
probabilities  Probability of each observation being from this distribution. 
trials  Number of trials to perform; the model in these trials with the greatest loglikelihood will be selected. 
useExistingModel  If true, the existing model is used as an initial model for the estimation. 
fitter  Fitting type that estimates observations. 

inline 
Return a const reference to the a priori weights of each Gaussian.
Definition at line 157 of file diagonal_gmm.hpp.

inline 
Return a reference to the a priori weights of each Gaussian.
Definition at line 159 of file diagonal_gmm.hpp.
References DiagonalGMM::Classify(), DiagonalGMM::LogProbability(), DiagonalGMM::Probability(), DiagonalGMM::Random(), DiagonalGMM::serialize(), and DiagonalGMM::Train().