Class for computing the maximum-likelihood estimates of the parameters of a Gaussian mixture model. More...
#include <mle-full-gmm.h>
Public Member Functions | |
AccumFullGmm () | |
AccumFullGmm (int32 num_comp, int32 dim, GmmFlagsType flags) | |
AccumFullGmm (const FullGmm &gmm, GmmFlagsType flags) | |
AccumFullGmm (const AccumFullGmm &other) | |
void | Read (std::istream &in_stream, bool binary, bool add) |
void | Write (std::ostream &out_stream, bool binary) const |
void | Resize (int32 num_components, int32 dim, GmmFlagsType flags) |
Allocates memory for accumulators. More... | |
void | Resize (const FullGmm &gmm, GmmFlagsType flags) |
Calls Resize with arguments based on gmm_ptr_. More... | |
void | ResizeVarAccumulator (int32 num_comp, int32 dim) |
int32 | NumGauss () const |
Returns the number of mixture components. More... | |
int32 | Dim () const |
Returns the dimensionality of the feature vectors. More... | |
void | SetZero (GmmFlagsType flags) |
void | Scale (BaseFloat f, GmmFlagsType flags) |
void | AccumulateForComponent (const VectorBase< BaseFloat > &data, int32 comp_index, BaseFloat weight) |
Accumulate for a single component, given the posterior. More... | |
void | AccumulateFromPosteriors (const VectorBase< BaseFloat > &data, const VectorBase< BaseFloat > &gauss_posteriors) |
Accumulate for all components, given the posteriors. More... | |
BaseFloat | AccumulateFromFull (const FullGmm &gmm, const VectorBase< BaseFloat > &data, BaseFloat frame_posterior) |
Accumulate for all components given a full-covariance GMM. More... | |
BaseFloat | AccumulateFromDiag (const DiagGmm &gmm, const VectorBase< BaseFloat > &data, BaseFloat frame_posterior) |
Accumulate for all components given a diagonal-covariance GMM. More... | |
GmmFlagsType | Flags () const |
Accessors. More... | |
const Vector< double > & | occupancy () const |
const Matrix< double > & | mean_accumulator () const |
const std::vector< SpMatrix< double > > & | covariance_accumulator () const |
Private Attributes | |
int32 | dim_ |
int32 | num_comp_ |
GmmFlagsType | flags_ |
Vector< double > | occupancy_ |
Matrix< double > | mean_accumulator_ |
std::vector< SpMatrix< double > > | covariance_accumulator_ |
Class for computing the maximum-likelihood estimates of the parameters of a Gaussian mixture model.
Definition at line 74 of file mle-full-gmm.h.
|
inline |
Definition at line 76 of file mle-full-gmm.h.
|
inline |
Definition at line 77 of file mle-full-gmm.h.
|
inlineexplicit |
Definition at line 81 of file mle-full-gmm.h.
|
explicit |
Definition at line 31 of file mle-full-gmm.cc.
void AccumulateForComponent | ( | const VectorBase< BaseFloat > & | data, |
int32 | comp_index, | ||
BaseFloat | weight | ||
) |
Accumulate for a single component, given the posterior.
Definition at line 96 of file mle-full-gmm.cc.
References AccumFullGmm::covariance_accumulator_, VectorBase< Real >::Dim(), AccumFullGmm::Dim(), AccumFullGmm::flags_, KALDI_ASSERT, kaldi::kGmmMeans, kaldi::kGmmVariances, AccumFullGmm::mean_accumulator_, AccumFullGmm::occupancy_, and MatrixBase< Real >::Row().
Referenced by kaldi::AccumulateForUtterance(), main(), and TestComponentAcc().
BaseFloat AccumulateFromDiag | ( | const DiagGmm & | gmm, |
const VectorBase< BaseFloat > & | data, | ||
BaseFloat | frame_posterior | ||
) |
Accumulate for all components given a diagonal-covariance GMM.
Computes posteriors and returns log-likelihood
Definition at line 157 of file mle-full-gmm.cc.
References AccumFullGmm::AccumulateFromPosteriors(), DiagGmm::ComponentPosteriors(), DiagGmm::Dim(), AccumFullGmm::Dim(), KALDI_ASSERT, DiagGmm::NumGauss(), and AccumFullGmm::NumGauss().
Referenced by kaldi::AccumulateForUtterance().
BaseFloat AccumulateFromFull | ( | const FullGmm & | gmm, |
const VectorBase< BaseFloat > & | data, | ||
BaseFloat | frame_posterior | ||
) |
Accumulate for all components given a full-covariance GMM.
Computes posteriors and returns log-likelihood
Definition at line 143 of file mle-full-gmm.cc.
References AccumFullGmm::AccumulateFromPosteriors(), FullGmm::ComponentPosteriors(), FullGmm::Dim(), AccumFullGmm::Dim(), KALDI_ASSERT, FullGmm::NumGauss(), and AccumFullGmm::NumGauss().
Referenced by main(), test_flags_driven_update(), TestComponentAcc(), UnitTestEstimateFullGmm(), and UnitTestFullGmmEst().
void AccumulateFromPosteriors | ( | const VectorBase< BaseFloat > & | data, |
const VectorBase< BaseFloat > & | gauss_posteriors | ||
) |
Accumulate for all components, given the posteriors.
Definition at line 112 of file mle-full-gmm.cc.
References VectorBase< Real >::AddVec(), SpMatrix< Real >::AddVec2(), MatrixBase< Real >::AddVecVec(), VectorBase< Real >::CopyFromVec(), AccumFullGmm::covariance_accumulator_, VectorBase< Real >::Dim(), AccumFullGmm::Dim(), AccumFullGmm::flags_, rnnlm::i, KALDI_ASSERT, kaldi::kGmmMeans, kaldi::kGmmVariances, AccumFullGmm::mean_accumulator_, AccumFullGmm::NumGauss(), AccumFullGmm::occupancy_, and MatrixBase< Real >::Row().
Referenced by AccumFullGmm::AccumulateFromDiag(), and AccumFullGmm::AccumulateFromFull().
|
inline |
Definition at line 129 of file mle-full-gmm.h.
Referenced by FmllrDiagGmmAccs::FmllrDiagGmmAccs(), kaldi::MleFullGmmUpdate(), and kaldi::MlObjective().
|
inline |
Returns the dimensionality of the feature vectors.
Definition at line 99 of file mle-full-gmm.h.
Referenced by AccumFullGmm::AccumulateForComponent(), AccumFullGmm::AccumulateFromDiag(), AccumFullGmm::AccumulateFromFull(), AccumFullGmm::AccumulateFromPosteriors(), FmllrDiagGmmAccs::FmllrDiagGmmAccs(), and AccumFullGmm::Read().
|
inline |
Accessors.
Definition at line 126 of file mle-full-gmm.h.
Referenced by kaldi::MleFullGmmUpdate(), kaldi::MlObjective(), AccumFullGmm::Read(), and test_io().
|
inline |
Definition at line 128 of file mle-full-gmm.h.
Referenced by FmllrDiagGmmAccs::FmllrDiagGmmAccs(), kaldi::MleFullGmmUpdate(), and kaldi::MlObjective().
|
inline |
Returns the number of mixture components.
Definition at line 97 of file mle-full-gmm.h.
Referenced by AccumFullGmm::AccumulateFromDiag(), AccumFullGmm::AccumulateFromFull(), AccumFullGmm::AccumulateFromPosteriors(), FmllrDiagGmmAccs::FmllrDiagGmmAccs(), AccumFullGmm::Read(), and TestComponentAcc().
|
inline |
Definition at line 127 of file mle-full-gmm.h.
Referenced by FmllrDiagGmmAccs::FmllrDiagGmmAccs(), kaldi::MleFullGmmUpdate(), and kaldi::MlObjective().
Definition at line 171 of file mle-full-gmm.cc.
References MatrixBase< Real >::AddMat(), VectorBase< Real >::AddVec(), SpMatrix< Real >::AddVec2(), AccumFullGmm::covariance_accumulator_, AccumFullGmm::Dim(), kaldi::ExpectToken(), AccumFullGmm::Flags(), kaldi::GmmFlagsToString(), rnnlm::i, KALDI_ASSERT, KALDI_ERR, AccumFullGmm::mean_accumulator_, AccumFullGmm::NumGauss(), AccumFullGmm::occupancy_, PackedMatrix< Real >::Read(), Vector< Real >::Read(), Matrix< Real >::Read(), kaldi::ReadBasicType(), kaldi::ReadToken(), AccumFullGmm::Resize(), MatrixBase< Real >::Row(), VectorBase< Real >::SetZero(), and MatrixBase< Real >::SetZero().
Referenced by main(), and test_io().
void Resize | ( | int32 | num_components, |
int32 | dim, | ||
GmmFlagsType | flags | ||
) |
Allocates memory for accumulators.
Definition at line 37 of file mle-full-gmm.cc.
References kaldi::AugmentGmmFlags(), AccumFullGmm::covariance_accumulator_, AccumFullGmm::dim_, AccumFullGmm::flags_, kaldi::kGmmMeans, kaldi::kGmmVariances, AccumFullGmm::mean_accumulator_, AccumFullGmm::num_comp_, AccumFullGmm::occupancy_, Vector< Real >::Resize(), Matrix< Real >::Resize(), and AccumFullGmm::ResizeVarAccumulator().
Referenced by main(), AccumFullGmm::Read(), test_flags_driven_update(), test_io(), TestComponentAcc(), and UnitTestEstimateFullGmm().
|
inline |
Calls Resize with arguments based on gmm_ptr_.
Definition at line 141 of file mle-full-gmm.h.
References FullGmm::Dim(), kaldi::MleFullGmmUpdate(), kaldi::MlObjective(), and FullGmm::NumGauss().
Definition at line 53 of file mle-full-gmm.cc.
References AccumFullGmm::covariance_accumulator_, rnnlm::i, and KALDI_ASSERT.
Referenced by AccumFullGmm::Resize().
void Scale | ( | BaseFloat | f, |
GmmFlagsType | flags | ||
) |
Definition at line 79 of file mle-full-gmm.cc.
References AccumFullGmm::covariance_accumulator_, rnnlm::d, AccumFullGmm::flags_, rnnlm::i, KALDI_ERR, kaldi::kGmmMeans, kaldi::kGmmVariances, kaldi::kGmmWeights, AccumFullGmm::mean_accumulator_, AccumFullGmm::occupancy_, MatrixBase< Real >::Scale(), and VectorBase< Real >::Scale().
Referenced by test_io().
void SetZero | ( | GmmFlagsType | flags | ) |
Definition at line 63 of file mle-full-gmm.cc.
References AccumFullGmm::covariance_accumulator_, AccumFullGmm::flags_, rnnlm::i, KALDI_ERR, kaldi::kGmmMeans, kaldi::kGmmVariances, kaldi::kGmmWeights, AccumFullGmm::mean_accumulator_, AccumFullGmm::occupancy_, VectorBase< Real >::SetZero(), and MatrixBase< Real >::SetZero().
Referenced by test_flags_driven_update(), TestComponentAcc(), and UnitTestEstimateFullGmm().
void Write | ( | std::ostream & | out_stream, |
bool | binary | ||
) | const |
Definition at line 230 of file mle-full-gmm.cc.
References SpMatrix< Real >::AddVec2(), AccumFullGmm::covariance_accumulator_, AccumFullGmm::dim_, AccumFullGmm::flags_, rnnlm::i, KALDI_ASSERT, kaldi::kGmmVariances, AccumFullGmm::mean_accumulator_, AccumFullGmm::num_comp_, AccumFullGmm::occupancy_, MatrixBase< Real >::Row(), PackedMatrix< Real >::Write(), VectorBase< Real >::Write(), MatrixBase< Real >::Write(), kaldi::WriteBasicType(), and kaldi::WriteToken().
Referenced by main(), and test_io().
|
private |
Definition at line 138 of file mle-full-gmm.h.
Referenced by AccumFullGmm::AccumulateForComponent(), AccumFullGmm::AccumulateFromPosteriors(), AccumFullGmm::Read(), AccumFullGmm::Resize(), AccumFullGmm::ResizeVarAccumulator(), AccumFullGmm::Scale(), AccumFullGmm::SetZero(), and AccumFullGmm::Write().
|
private |
Definition at line 132 of file mle-full-gmm.h.
Referenced by AccumFullGmm::Resize(), and AccumFullGmm::Write().
|
private |
Definition at line 134 of file mle-full-gmm.h.
Referenced by AccumFullGmm::AccumulateForComponent(), AccumFullGmm::AccumulateFromPosteriors(), AccumFullGmm::Resize(), AccumFullGmm::Scale(), AccumFullGmm::SetZero(), and AccumFullGmm::Write().
|
private |
Definition at line 137 of file mle-full-gmm.h.
Referenced by AccumFullGmm::AccumulateForComponent(), AccumFullGmm::AccumulateFromPosteriors(), AccumFullGmm::Read(), AccumFullGmm::Resize(), AccumFullGmm::Scale(), AccumFullGmm::SetZero(), and AccumFullGmm::Write().
|
private |
Definition at line 133 of file mle-full-gmm.h.
Referenced by AccumFullGmm::Resize(), and AccumFullGmm::Write().
|
private |
Definition at line 136 of file mle-full-gmm.h.
Referenced by AccumFullGmm::AccumulateForComponent(), AccumFullGmm::AccumulateFromPosteriors(), AccumFullGmm::Read(), AccumFullGmm::Resize(), AccumFullGmm::Scale(), AccumFullGmm::SetZero(), and AccumFullGmm::Write().