#include <mle-am-diag-gmm.h>
Public Member Functions | |
AccumAmDiagGmm () | |
~AccumAmDiagGmm () | |
void | Read (std::istream &in_stream, bool binary, bool add=false) |
void | Write (std::ostream &out_stream, bool binary) const |
void | Init (const AmDiagGmm &model, GmmFlagsType flags) |
Initializes accumulators for each GMM based on the number of components and dimension. More... | |
void | Init (const AmDiagGmm &model, int32 dim, GmmFlagsType flags) |
Initialization using different dimension than model. More... | |
void | SetZero (GmmFlagsType flags) |
BaseFloat | AccumulateForGmm (const AmDiagGmm &model, const VectorBase< BaseFloat > &data, int32 gmm_index, BaseFloat weight) |
Accumulate stats for a single GMM in the model; returns log likelihood. More... | |
BaseFloat | AccumulateForGmmTwofeats (const AmDiagGmm &model, const VectorBase< BaseFloat > &data1, const VectorBase< BaseFloat > &data2, int32 gmm_index, BaseFloat weight) |
Accumulate stats for a single GMM in the model; uses data1 for getting posteriors and data2 for stats. More... | |
void | AccumulateFromPosteriors (const AmDiagGmm &model, const VectorBase< BaseFloat > &data, int32 gmm_index, const VectorBase< BaseFloat > &posteriors) |
Accumulates stats for a single GMM in the model using pre-computed Gaussian posteriors. More... | |
void | AccumulateForGaussian (const AmDiagGmm &am, const VectorBase< BaseFloat > &data, int32 gmm_index, int32 gauss_index, BaseFloat weight) |
Accumulate stats for a single Gaussian component in the model. More... | |
int32 | NumAccs () |
int32 | NumAccs () const |
BaseFloat | TotStatsCount () const |
BaseFloat | TotCount () const |
BaseFloat | TotLogLike () const |
const AccumDiagGmm & | GetAcc (int32 index) const |
AccumDiagGmm & | GetAcc (int32 index) |
void | Add (BaseFloat scale, const AccumAmDiagGmm &other) |
void | Scale (BaseFloat scale) |
int32 | Dim () const |
Private Member Functions | |
KALDI_DISALLOW_COPY_AND_ASSIGN (AccumAmDiagGmm) | |
Private Attributes | |
std::vector< AccumDiagGmm * > | gmm_accumulators_ |
MLE accumulators and update methods for the GMMs. More... | |
double | total_frames_ |
Total counts & likelihood (for diagnostics) More... | |
double | total_log_like_ |
Definition at line 34 of file mle-am-diag-gmm.h.
|
inline |
Definition at line 36 of file mle-am-diag-gmm.h.
References AccumAmDiagGmm::AccumulateForGaussian(), AccumAmDiagGmm::AccumulateForGmm(), AccumAmDiagGmm::AccumulateForGmmTwofeats(), AccumAmDiagGmm::AccumulateFromPosteriors(), AccumAmDiagGmm::Init(), AccumAmDiagGmm::Read(), AccumAmDiagGmm::SetZero(), AccumAmDiagGmm::Write(), and AccumAmDiagGmm::~AccumAmDiagGmm().
~AccumAmDiagGmm | ( | ) |
Definition at line 37 of file mle-am-diag-gmm.cc.
References kaldi::DeletePointers(), and AccumAmDiagGmm::gmm_accumulators_.
Referenced by AccumAmDiagGmm::AccumAmDiagGmm().
void AccumulateForGaussian | ( | const AmDiagGmm & | am, |
const VectorBase< BaseFloat > & | data, | ||
int32 | gmm_index, | ||
int32 | gauss_index, | ||
BaseFloat | weight | ||
) |
Accumulate stats for a single Gaussian component in the model.
Definition at line 108 of file mle-am-diag-gmm.cc.
References AmDiagGmm::GetPdf(), AccumAmDiagGmm::gmm_accumulators_, KALDI_ASSERT, AccumAmDiagGmm::NumAccs(), and DiagGmm::NumGauss().
Referenced by AccumAmDiagGmm::AccumAmDiagGmm().
BaseFloat AccumulateForGmm | ( | const AmDiagGmm & | model, |
const VectorBase< BaseFloat > & | data, | ||
int32 | gmm_index, | ||
BaseFloat | weight | ||
) |
Accumulate stats for a single GMM in the model; returns log likelihood.
This does not work with multiple feature transforms.
Definition at line 69 of file mle-am-diag-gmm.cc.
References AmDiagGmm::GetPdf(), AccumAmDiagGmm::gmm_accumulators_, KALDI_ASSERT, AccumAmDiagGmm::total_frames_, and AccumAmDiagGmm::total_log_like_.
Referenced by AccumAmDiagGmm::AccumAmDiagGmm(), main(), TestAmDiagGmmAccsIO(), and kaldi::UnitTestRegtreeFmllrDiagGmm().
BaseFloat AccumulateForGmmTwofeats | ( | const AmDiagGmm & | model, |
const VectorBase< BaseFloat > & | data1, | ||
const VectorBase< BaseFloat > & | data2, | ||
int32 | gmm_index, | ||
BaseFloat | weight | ||
) |
Accumulate stats for a single GMM in the model; uses data1 for getting posteriors and data2 for stats.
Returns log likelihood.
Definition at line 81 of file mle-am-diag-gmm.cc.
References AccumDiagGmm::AccumulateFromPosteriors(), AmDiagGmm::GetPdf(), AccumAmDiagGmm::gmm_accumulators_, KALDI_ASSERT, VectorBase< Real >::Scale(), AccumAmDiagGmm::total_frames_, and AccumAmDiagGmm::total_log_like_.
Referenced by AccumAmDiagGmm::AccumAmDiagGmm(), and main().
void AccumulateFromPosteriors | ( | const AmDiagGmm & | model, |
const VectorBase< BaseFloat > & | data, | ||
int32 | gmm_index, | ||
const VectorBase< BaseFloat > & | posteriors | ||
) |
Accumulates stats for a single GMM in the model using pre-computed Gaussian posteriors.
Definition at line 100 of file mle-am-diag-gmm.cc.
References AccumAmDiagGmm::gmm_accumulators_, KALDI_ASSERT, AccumAmDiagGmm::NumAccs(), VectorBase< Real >::Sum(), and AccumAmDiagGmm::total_frames_.
Referenced by AccumAmDiagGmm::AccumAmDiagGmm().
void Add | ( | BaseFloat | scale, |
const AccumAmDiagGmm & | other | ||
) |
Definition at line 279 of file mle-am-diag-gmm.cc.
References AccumAmDiagGmm::gmm_accumulators_, rnnlm::i, KALDI_ASSERT, AccumAmDiagGmm::NumAccs(), AccumAmDiagGmm::total_frames_, and AccumAmDiagGmm::total_log_like_.
Referenced by AccumAmDiagGmm::TotLogLike().
|
inline |
Definition at line 94 of file mle-am-diag-gmm.h.
References AccumAmDiagGmm::gmm_accumulators_.
Referenced by kaldi::MapAmDiagGmmUpdate(), and kaldi::MleAmDiagGmmUpdate().
const AccumDiagGmm & GetAcc | ( | int32 | index | ) | const |
Definition at line 27 of file mle-am-diag-gmm.cc.
References AccumAmDiagGmm::gmm_accumulators_, and KALDI_ASSERT.
Referenced by kaldi::ComputeAmGmmFeatureDeriv(), kaldi::DoRescalingUpdate(), kaldi::GetStatsDerivative(), kaldi::IsmoothStatsAmDiagGmm(), kaldi::IsmoothStatsAmDiagGmmFromModel(), main(), kaldi::MapAmDiagGmmUpdate(), kaldi::MleAmDiagGmmUpdate(), AccumAmDiagGmm::Scale(), AccumAmDiagGmm::TotLogLike(), AccumAmDiagGmm::TotStatsCount(), kaldi::UpdateEbwAmDiagGmm(), and kaldi::UpdateEbwWeightsAmDiagGmm().
AccumDiagGmm & GetAcc | ( | int32 | index | ) |
Definition at line 32 of file mle-am-diag-gmm.cc.
References AccumAmDiagGmm::gmm_accumulators_, and KALDI_ASSERT.
void Init | ( | const AmDiagGmm & | model, |
GmmFlagsType | flags | ||
) |
Initializes accumulators for each GMM based on the number of components and dimension.
Definition at line 41 of file mle-am-diag-gmm.cc.
References kaldi::DeletePointers(), AmDiagGmm::GetPdf(), AccumAmDiagGmm::gmm_accumulators_, rnnlm::i, and AmDiagGmm::NumPdfs().
Referenced by AccumAmDiagGmm::AccumAmDiagGmm(), kaldi::GetStatsDerivative(), main(), TestAmDiagGmmAccsIO(), and kaldi::UnitTestRegtreeFmllrDiagGmm().
void Init | ( | const AmDiagGmm & | model, |
int32 | dim, | ||
GmmFlagsType | flags | ||
) |
Initialization using different dimension than model.
Definition at line 51 of file mle-am-diag-gmm.cc.
References kaldi::DeletePointers(), AmDiagGmm::GetPdf(), AccumAmDiagGmm::gmm_accumulators_, rnnlm::i, KALDI_ASSERT, DiagGmm::NumGauss(), and AmDiagGmm::NumPdfs().
|
private |
|
inline |
Definition at line 75 of file mle-am-diag-gmm.h.
References AccumAmDiagGmm::gmm_accumulators_.
Referenced by AccumAmDiagGmm::AccumulateForGaussian(), AccumAmDiagGmm::AccumulateFromPosteriors(), AccumAmDiagGmm::Add(), kaldi::DoRescalingUpdate(), kaldi::GetStatsDerivative(), kaldi::IsmoothStatsAmDiagGmm(), kaldi::IsmoothStatsAmDiagGmmFromModel(), main(), kaldi::MapAmDiagGmmUpdate(), kaldi::MleAmDiagGmmUpdate(), AccumAmDiagGmm::Scale(), AccumAmDiagGmm::TotStatsCount(), kaldi::UpdateEbwAmDiagGmm(), and kaldi::UpdateEbwWeightsAmDiagGmm().
|
inline |
Definition at line 77 of file mle-am-diag-gmm.h.
References AccumAmDiagGmm::gmm_accumulators_, and AccumAmDiagGmm::TotStatsCount().
Definition at line 117 of file mle-am-diag-gmm.cc.
References kaldi::ExpectToken(), AccumAmDiagGmm::gmm_accumulators_, KALDI_ASSERT, KALDI_ERR, kaldi::ReadBasicType(), AccumAmDiagGmm::total_frames_, and AccumAmDiagGmm::total_log_like_.
Referenced by AccumAmDiagGmm::AccumAmDiagGmm(), main(), and TestAmDiagGmmAccsIO().
void Scale | ( | BaseFloat | scale | ) |
Definition at line 270 of file mle-am-diag-gmm.cc.
References AccumDiagGmm::Flags(), AccumAmDiagGmm::GetAcc(), rnnlm::i, AccumAmDiagGmm::NumAccs(), AccumDiagGmm::Scale(), AccumAmDiagGmm::total_frames_, and AccumAmDiagGmm::total_log_like_.
Referenced by AccumAmDiagGmm::TotLogLike().
void SetZero | ( | GmmFlagsType | flags | ) |
Definition at line 63 of file mle-am-diag-gmm.cc.
References AccumAmDiagGmm::gmm_accumulators_, and rnnlm::i.
Referenced by AccumAmDiagGmm::AccumAmDiagGmm(), and main().
|
inline |
Definition at line 83 of file mle-am-diag-gmm.h.
References AccumAmDiagGmm::total_frames_.
Referenced by main(), and TestAmDiagGmmAccsIO().
|
inline |
Definition at line 84 of file mle-am-diag-gmm.h.
References AccumAmDiagGmm::Add(), AccumAmDiagGmm::GetAcc(), AccumAmDiagGmm::Scale(), and AccumAmDiagGmm::total_log_like_.
Referenced by main(), and TestAmDiagGmmAccsIO().
BaseFloat TotStatsCount | ( | ) | const |
Definition at line 261 of file mle-am-diag-gmm.cc.
References AccumAmDiagGmm::GetAcc(), rnnlm::i, AccumAmDiagGmm::NumAccs(), and AccumDiagGmm::occupancy().
Referenced by main(), and AccumAmDiagGmm::NumAccs().
void Write | ( | std::ostream & | out_stream, |
bool | binary | ||
) | const |
Definition at line 153 of file mle-am-diag-gmm.cc.
References AccumAmDiagGmm::gmm_accumulators_, AccumAmDiagGmm::total_frames_, AccumAmDiagGmm::total_log_like_, kaldi::WriteBasicType(), and kaldi::WriteToken().
Referenced by AccumAmDiagGmm::AccumAmDiagGmm(), main(), and TestAmDiagGmmAccsIO().
|
private |
MLE accumulators and update methods for the GMMs.
Definition at line 101 of file mle-am-diag-gmm.h.
Referenced by AccumAmDiagGmm::AccumulateForGaussian(), AccumAmDiagGmm::AccumulateForGmm(), AccumAmDiagGmm::AccumulateForGmmTwofeats(), AccumAmDiagGmm::AccumulateFromPosteriors(), AccumAmDiagGmm::Add(), AccumAmDiagGmm::Dim(), AccumAmDiagGmm::GetAcc(), AccumAmDiagGmm::Init(), AccumAmDiagGmm::NumAccs(), AccumAmDiagGmm::Read(), AccumAmDiagGmm::SetZero(), AccumAmDiagGmm::Write(), and AccumAmDiagGmm::~AccumAmDiagGmm().
|
private |
Total counts & likelihood (for diagnostics)
Definition at line 104 of file mle-am-diag-gmm.h.
Referenced by AccumAmDiagGmm::AccumulateForGmm(), AccumAmDiagGmm::AccumulateForGmmTwofeats(), AccumAmDiagGmm::AccumulateFromPosteriors(), AccumAmDiagGmm::Add(), AccumAmDiagGmm::Read(), AccumAmDiagGmm::Scale(), AccumAmDiagGmm::TotCount(), and AccumAmDiagGmm::Write().
|
private |
Definition at line 104 of file mle-am-diag-gmm.h.
Referenced by AccumAmDiagGmm::AccumulateForGmm(), AccumAmDiagGmm::AccumulateForGmmTwofeats(), AccumAmDiagGmm::Add(), AccumAmDiagGmm::Read(), AccumAmDiagGmm::Scale(), AccumAmDiagGmm::TotLogLike(), and AccumAmDiagGmm::Write().