GmmSet Class Reference

Class holding set of diagonal covariance GMM's. More...

#include <util.H>

Inheritance diagram for GmmSet:

GmmScorer

List of all members.

Public Member Functions

 GmmSet (const string &fileName=string())
 Ctor; loads from file fileName if argument present.
void read (const string &fileName)
 Reads GMM parameters from file fileName.
void write (const string &fileName) const
 Writes GMM parameters to file fileName.
void init (const vector< int > &gmmCompCounts, unsigned dimCnt, const vector< int > &compMap=vector< int >())
 Initializes object, where the vector gmmCompCounts holds the number of component Gaussians of each GMM, and dimCnt is the dimension of the Gaussians.
void clear ()
 Clears object, i.e., deletes all GMM's.
bool empty () const
 Returns whether object is empty, i.e., has no GMM's.
unsigned get_gmm_count () const
 Returns number of GMM's in model.
unsigned get_gaussian_count () const
 Returns total number of individual Gaussians in model.
unsigned get_dim_count () const
 Returns dimension of Gaussians.
unsigned get_component_count (unsigned gmmIdx) const
 Returns number of component Gaussians in gmmIdx-th GMM.
unsigned get_gaussian_index (unsigned gmmIdx, unsigned compIdx) const
 Returns Gaussian index for compIdx-th component of gmmIdx-th GMM.
double get_component_weight (unsigned gmmIdx, unsigned compIdx) const
 Returns mixture weight of compIdx-th component of gmmIdx-th GMM.
void set_component_weight (unsigned gmmIdx, unsigned compIdx, double wgt)
 Sets mixture weight of compIdx-th component of gmmIdx-th GMM to wgt.
double get_gaussian_mean (unsigned gaussIdx, unsigned dimIdx) const
 Returns mean for dimension dimIdx for Gaussian with index gaussIdx.
double get_gaussian_var (unsigned gaussIdx, unsigned dimIdx) const
 Returns variance for dimension dimIdx for Gaussian with index gaussIdx.
void set_gaussian_mean (unsigned gaussIdx, unsigned dimIdx, double val)
 Sets mean for dimension dimIdx for Gaussian gaussIdx.
void set_gaussian_var (unsigned gaussIdx, unsigned dimIdx, double val)
 Sets variance for dimension dimIdx for Gaussian gaussIdx.
void copy_gaussian (unsigned dstGaussIdx, const GmmSet &srcGmmSet, unsigned srcGaussIdx)
 Copies the means and variances of Gaussian srcGaussIdx in srcGmmSet into Gaussian dstGaussIdx in this object.
void calc_gmm_probs (const matrix< double > &feats, matrix< double > &logProbs) const
 Given input feature vectors, computes log prob (base e) of each GMM for each frame; i.e., on exit logProbs will have the same number of rows as feats and one column for each GMM.
double calc_component_probs (const vector< double > &feats, unsigned gmmIdx, vector< double > &logProbs) const
 Computes log prob (base e) of each component Gaussian for GMM gmmIdx for feature vector feats.


Detailed Description

Class holding set of diagonal covariance GMM's.

Here, we summarize the key routines for accessing the parameters of each GMM. Each GMM has a set of component Gaussians. To find the number of components of a GMM, use get_component_count(). To find the mixture weight of a particular component of a GMM, use get_component_weight(). To get the means and variances of a particular component, first call get_gaussian_index() to find the index of the corresponding Gaussian. Then, one can call get_gaussian_mean() and get_gaussian_var() with this index to find the means and variances. The reason for this indirection is to support the sharing of Gaussians between GMM's.


Constructor & Destructor Documentation

GmmSet::GmmSet ( const string &  fileName = string()  ) 

Ctor; loads from file fileName if argument present.


Member Function Documentation

void GmmSet::read ( const string &  fileName  ) 

Reads GMM parameters from file fileName.

void GmmSet::write ( const string &  fileName  )  const

Writes GMM parameters to file fileName.

void GmmSet::init ( const vector< int > &  gmmCompCounts,
unsigned  dimCnt,
const vector< int > &  compMap = vector< int >() 
)

Initializes object, where the vector gmmCompCounts holds the number of component Gaussians of each GMM, and dimCnt is the dimension of the Gaussians.

Component weights are initialized to be uniform; and means and variances for each dimension are set to 0 and 1, respectively. If the optional argument compMap is not provided, then no Gaussians are shared between GMM's. Otherwise, the vector compMap holds the index of the Gaussian for each component of each GMM, in order; i.e., it contains first the indices of each component of the 0th GMM, then the 1st GMM, etc.

void GmmSet::clear (  ) 

Clears object, i.e., deletes all GMM's.

bool GmmSet::empty (  )  const [inline]

Returns whether object is empty, i.e., has no GMM's.

unsigned GmmSet::get_gmm_count (  )  const [inline, virtual]

Returns number of GMM's in model.

Implements GmmScorer.

unsigned GmmSet::get_gaussian_count (  )  const [inline]

Returns total number of individual Gaussians in model.

unsigned GmmSet::get_dim_count (  )  const [inline, virtual]

Returns dimension of Gaussians.

Implements GmmScorer.

unsigned GmmSet::get_component_count ( unsigned  gmmIdx  )  const [inline]

Returns number of component Gaussians in gmmIdx-th GMM.

GMM's are numbered starting from 0.

unsigned GmmSet::get_gaussian_index ( unsigned  gmmIdx,
unsigned  compIdx 
) const [inline]

Returns Gaussian index for compIdx-th component of gmmIdx-th GMM.

This index is needed for looking up or setting Gaussian parameters. GMM's and components are numbered starting from 0.

See also:
get_gaussian_mean(), get_gaussian_var(), etc.

double GmmSet::get_component_weight ( unsigned  gmmIdx,
unsigned  compIdx 
) const [inline]

Returns mixture weight of compIdx-th component of gmmIdx-th GMM.

GMM's and components are numbered starting from 0.

void GmmSet::set_component_weight ( unsigned  gmmIdx,
unsigned  compIdx,
double  wgt 
) [inline]

Sets mixture weight of compIdx-th component of gmmIdx-th GMM to wgt.

GMM's and components are numbered starting from 0.

double GmmSet::get_gaussian_mean ( unsigned  gaussIdx,
unsigned  dimIdx 
) const [inline]

Returns mean for dimension dimIdx for Gaussian with index gaussIdx.

Gaussians and dimensions are numbered starting from 0.

double GmmSet::get_gaussian_var ( unsigned  gaussIdx,
unsigned  dimIdx 
) const [inline]

Returns variance for dimension dimIdx for Gaussian with index gaussIdx.

Gaussians and dimensions are numbered starting from 0.

void GmmSet::set_gaussian_mean ( unsigned  gaussIdx,
unsigned  dimIdx,
double  val 
) [inline]

Sets mean for dimension dimIdx for Gaussian gaussIdx.

Gaussians and dimensions are numbered starting from 0.

void GmmSet::set_gaussian_var ( unsigned  gaussIdx,
unsigned  dimIdx,
double  val 
) [inline]

Sets variance for dimension dimIdx for Gaussian gaussIdx.

Gaussians and dimensions are numbered starting from 0.

void GmmSet::copy_gaussian ( unsigned  dstGaussIdx,
const GmmSet srcGmmSet,
unsigned  srcGaussIdx 
)

Copies the means and variances of Gaussian srcGaussIdx in srcGmmSet into Gaussian dstGaussIdx in this object.

Gaussians are numbered starting from 0.

double GmmSet::calc_component_probs ( const vector< double > &  feats,
unsigned  gmmIdx,
vector< double > &  logProbs 
) const

Computes log prob (base e) of each component Gaussian for GMM gmmIdx for feature vector feats.

Places result in logProbs. Returns total log prob of GMM. GMM's are numbered starting from 0.


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

Generated on Thu Nov 5 09:26:36 2009 for asr_lib by  doxygen 1.5.5