KrisLibrary
1.0.0
|
A model of a probability distribution consisting of k gaussians. More...
#include <GaussianMixtureModel.h>
Public Member Functions | |
GaussianMixtureModel (int k, int d) | |
GaussianMixtureModel (const GaussianMixtureModel &) | |
int | NumDims () const |
void | Resize (int k, int d) |
void | SetLinearTransform (const GaussianMixtureModel &gmm, const Matrix &A, const Vector &b) |
bool | TrainEM (const std::vector< Vector > &examples, Real &tol, int maxIters, int verbose=0) |
Solves the max likelihood model from training data. More... | |
bool | TrainDiagonalEM (const std::vector< Vector > &examples, Real &tol, int maxIters, int verbose=0) |
Real | LogLikelihood (const std::vector< Vector > &data) |
Computes the log likelihood of the data. | |
int | PickGaussian () const |
Real | Probability (const Vector &x) const |
void | Generate (Vector &x) const |
void | GetMean (Vector &x) const |
void | GetMode (Vector &x) const |
void | GetCovariance (Matrix &cov) const |
void | GetVariance (Vector &var) const |
void | Resample (int k) |
void | Cluster (const GaussianMixtureModel &gmm, int k) |
Public Attributes | |
std::vector< Gaussian< Real > > | gaussians |
std::vector< Real > | phi |
phi[i] gives probability of choosing gaussian[i] | |
A model of a probability distribution consisting of k gaussians.
bool Statistics::GaussianMixtureModel::TrainEM | ( | const std::vector< Vector > & | examples, |
Real & | tol, | ||
int | maxIters, | ||
int | verbose = 0 |
||
) |
Solves the max likelihood model from training data.
Runs expectation-maximization, starting from current values of gaussians, given the training data, a tolerance, # of max iterations. Returns true if tolerance was reached, returns log-likelihood of data in tol.
References ArrayUtils::copy(), Statistics::ExpNormalize(), Math::GaussianTransform(), Math::GetElements(), Math::IsFinite(), Math::IsInf(), Math::Gaussian< T >::L, Math::Gaussian< T >::logProbability(), Math::Gaussian< T >::mu, Statistics::Normalize(), phi, Statistics::GaussianMixtureModelRaw::phi, Math::RandomAllocate(), Math::Gaussian< T >::setCovariance(), Math::Sign(), and Math::WeightedSample().