This does not work with multiple feature transforms. More...
#include <fmllr-diag-gmm.h>
Classes | |
struct | SingleFrameStats |
Public Member Functions | |
FmllrDiagGmmAccs (const FmllrOptions &opts=FmllrOptions()) | |
FmllrDiagGmmAccs (const FmllrDiagGmmAccs &other) | |
FmllrDiagGmmAccs (int32 dim, const FmllrOptions &opts=FmllrOptions()) | |
FmllrDiagGmmAccs (const DiagGmm &gmm, const AccumFullGmm &fgmm_accs) | |
void | Init (size_t dim) |
void | Read (std::istream &in, bool binary, bool add) |
BaseFloat | AccumulateForGmm (const DiagGmm &gmm, const VectorBase< BaseFloat > &data, BaseFloat weight) |
Accumulate stats for a single GMM in the model; returns log likelihood. More... | |
BaseFloat | AccumulateForGmmPreselect (const DiagGmm &gmm, const std::vector< int32 > &gselect, const VectorBase< BaseFloat > &data, BaseFloat weight) |
This is like AccumulateForGmm but when you have gselect (Gaussian selection) information. More... | |
void | AccumulateFromPosteriors (const DiagGmm &gmm, const VectorBase< BaseFloat > &data, const VectorBase< BaseFloat > &posteriors) |
Accumulate stats for a GMM, given supplied posteriors. More... | |
void | AccumulateFromPosteriorsPreselect (const DiagGmm &gmm, const std::vector< int32 > &gselect, const VectorBase< BaseFloat > &data, const VectorBase< BaseFloat > &posteriors) |
Accumulate stats for a GMM, given supplied posteriors. More... | |
void | Update (const FmllrOptions &opts, MatrixBase< BaseFloat > *fmllr_mat, BaseFloat *objf_impr, BaseFloat *count) |
Update. More... | |
Public Member Functions inherited from AffineXformStats | |
AffineXformStats () | |
void | Init (int32 dim, int32 num_gs) |
int32 | Dim () const |
void | SetZero () |
void | CopyStats (const AffineXformStats &other) |
void | Add (const AffineXformStats &other) |
void | Write (std::ostream &out, bool binary) const |
void | Read (std::istream &in, bool binary, bool add) |
AffineXformStats (const AffineXformStats &other) | |
Private Member Functions | |
void | CommitSingleFrameStats () |
void | InitSingleFrameStats (const VectorBase< BaseFloat > &data) |
bool | DataHasChanged (const VectorBase< BaseFloat > &data) const |
Private Attributes | |
SingleFrameStats | single_frame_stats_ |
FmllrOptions | opts_ |
Additional Inherited Members | |
Public Attributes inherited from AffineXformStats | |
double | beta_ |
beta_ is the occupation count. More... | |
Matrix< double > | K_ |
K_ is the summed outer product of [mean times inverse variance] with [extended data], scaled by the occupation counts; dimension is dim by (dim+1) More... | |
std::vector< SpMatrix< double > > | G_ |
G_ is the outer product of extended-data, scaled by inverse variance, for each dimension. More... | |
int32 | dim_ |
dim_ is the feature dimension. More... | |
This does not work with multiple feature transforms.
Definition at line 61 of file fmllr-diag-gmm.h.
|
inline |
Definition at line 66 of file fmllr-diag-gmm.h.
|
inlineexplicit |
Definition at line 68 of file fmllr-diag-gmm.h.
|
inlineexplicit |
Definition at line 71 of file fmllr-diag-gmm.h.
FmllrDiagGmmAccs | ( | const DiagGmm & | gmm, |
const AccumFullGmm & | fgmm_accs | ||
) |
Definition at line 67 of file fmllr-diag-gmm.cc.
References MatrixBase< Real >::AddVecVec(), AffineXformStats::beta_, MatrixBase< Real >::CopyColFromVec(), AccumFullGmm::covariance_accumulator(), rnnlm::d, DiagGmm::Dim(), AccumFullGmm::Dim(), AffineXformStats::G_, FmllrDiagGmmAccs::Init(), DiagGmm::inv_vars(), AffineXformStats::K_, KALDI_ASSERT, AccumFullGmm::mean_accumulator(), DiagGmm::means_invvars(), DiagGmm::NumGauss(), AccumFullGmm::NumGauss(), AccumFullGmm::occupancy(), VectorBase< Real >::Range(), MatrixBase< Real >::Range(), and MatrixBase< Real >::Row().
BaseFloat AccumulateForGmm | ( | const DiagGmm & | gmm, |
const VectorBase< BaseFloat > & | data, | ||
BaseFloat | weight | ||
) |
Accumulate stats for a single GMM in the model; returns log likelihood.
Definition at line 101 of file fmllr-diag-gmm.cc.
References FmllrDiagGmmAccs::AccumulateFromPosteriors(), DiagGmm::ComponentPosteriors(), DiagGmm::NumGauss(), and VectorBase< Real >::Scale().
Referenced by kaldi::AccumulateForUtterance(), main(), kaldi::UnitTestFmllrDiagGmm(), kaldi::UnitTestFmllrDiagGmmDiagonal(), and kaldi::UnitTestFmllrDiagGmmOffset().
BaseFloat AccumulateForGmmPreselect | ( | const DiagGmm & | gmm, |
const std::vector< int32 > & | gselect, | ||
const VectorBase< BaseFloat > & | data, | ||
BaseFloat | weight | ||
) |
This is like AccumulateForGmm but when you have gselect (Gaussian selection) information.
Definition at line 114 of file fmllr-diag-gmm.cc.
References FmllrDiagGmmAccs::AccumulateFromPosteriorsPreselect(), KALDI_ASSERT, and DiagGmm::LogLikelihoodsPreselect().
void AccumulateFromPosteriors | ( | const DiagGmm & | gmm, |
const VectorBase< BaseFloat > & | data, | ||
const VectorBase< BaseFloat > & | posteriors | ||
) |
Accumulate stats for a GMM, given supplied posteriors.
Definition at line 30 of file fmllr-diag-gmm.cc.
References FmllrDiagGmmAccs::SingleFrameStats::a, FmllrDiagGmmAccs::SingleFrameStats::b, FmllrDiagGmmAccs::CommitSingleFrameStats(), FmllrDiagGmmAccs::SingleFrameStats::count, FmllrDiagGmmAccs::DataHasChanged(), FmllrDiagGmmAccs::InitSingleFrameStats(), DiagGmm::inv_vars(), kaldi::kTrans, DiagGmm::means_invvars(), FmllrDiagGmmAccs::single_frame_stats_, and VectorBase< Real >::Sum().
Referenced by FmllrDiagGmmAccs::AccumulateForGmm(), kaldi::AccumulateForUtterance(), SingleUtteranceGmmDecoder::EstimateFmllr(), kaldi::UnitTestFmllrDiagGmm(), kaldi::UnitTestFmllrDiagGmmDiagonal(), and kaldi::UnitTestFmllrDiagGmmOffset().
void AccumulateFromPosteriorsPreselect | ( | const DiagGmm & | gmm, |
const std::vector< int32 > & | gselect, | ||
const VectorBase< BaseFloat > & | data, | ||
const VectorBase< BaseFloat > & | posteriors | ||
) |
Accumulate stats for a GMM, given supplied posteriors.
The "posteriors" vector should be have the same size as "gselect".
Definition at line 45 of file fmllr-diag-gmm.cc.
References FmllrDiagGmmAccs::SingleFrameStats::a, FmllrDiagGmmAccs::SingleFrameStats::b, FmllrDiagGmmAccs::CommitSingleFrameStats(), FmllrDiagGmmAccs::SingleFrameStats::count, FmllrDiagGmmAccs::DataHasChanged(), VectorBase< Real >::Dim(), rnnlm::i, FmllrDiagGmmAccs::InitSingleFrameStats(), DiagGmm::inv_vars(), KALDI_ASSERT, DiagGmm::means_invvars(), MatrixBase< Real >::Row(), FmllrDiagGmmAccs::single_frame_stats_, and VectorBase< Real >::Sum().
Referenced by FmllrDiagGmmAccs::AccumulateForGmmPreselect(), and kaldi::AccumulateForUtterance().
|
private |
Definition at line 562 of file fmllr-diag-gmm.cc.
References FmllrDiagGmmAccs::SingleFrameStats::a, SpMatrix< Real >::AddVec2(), MatrixBase< Real >::AddVecVec(), FmllrDiagGmmAccs::SingleFrameStats::b, AffineXformStats::beta_, FmllrDiagGmmAccs::SingleFrameStats::count, AffineXformStats::Dim(), AffineXformStats::G_, rnnlm::i, AffineXformStats::K_, KALDI_ASSERT, FmllrDiagGmmAccs::opts_, VectorBase< Real >::Range(), FmllrDiagGmmAccs::single_frame_stats_, FmllrOptions::update_type, and FmllrDiagGmmAccs::SingleFrameStats::x.
Referenced by FmllrDiagGmmAccs::AccumulateFromPosteriors(), FmllrDiagGmmAccs::AccumulateFromPosteriorsPreselect(), and FmllrDiagGmmAccs::Update().
|
private |
Definition at line 542 of file fmllr-diag-gmm.cc.
References VectorBase< Real >::ApproxEqual(), AffineXformStats::Dim(), VectorBase< Real >::Dim(), KALDI_ASSERT, FmllrDiagGmmAccs::single_frame_stats_, and FmllrDiagGmmAccs::SingleFrameStats::x.
Referenced by FmllrDiagGmmAccs::AccumulateFromPosteriors(), and FmllrDiagGmmAccs::AccumulateFromPosteriorsPreselect().
|
inline |
Definition at line 81 of file fmllr-diag-gmm.h.
References AffineXformStats::Init().
Referenced by SingleUtteranceGmmDecoder::EstimateFmllr(), and FmllrDiagGmmAccs::FmllrDiagGmmAccs().
|
private |
Definition at line 554 of file fmllr-diag-gmm.cc.
References FmllrDiagGmmAccs::SingleFrameStats::a, FmllrDiagGmmAccs::SingleFrameStats::b, FmllrDiagGmmAccs::SingleFrameStats::count, FmllrDiagGmmAccs::single_frame_stats_, and FmllrDiagGmmAccs::SingleFrameStats::x.
Referenced by FmllrDiagGmmAccs::AccumulateFromPosteriors(), and FmllrDiagGmmAccs::AccumulateFromPosteriorsPreselect().
Definition at line 84 of file fmllr-diag-gmm.h.
References count, and AffineXformStats::Read().
Referenced by OnlineGmmAdaptationState::Read().
void Update | ( | const FmllrOptions & | opts, |
MatrixBase< BaseFloat > * | fmllr_mat, | ||
BaseFloat * | objf_impr, | ||
BaseFloat * | count | ||
) |
Update.
Definition at line 131 of file fmllr-diag-gmm.cc.
References AffineXformStats::beta_, FmllrDiagGmmAccs::CommitSingleFrameStats(), kaldi::ComputeFmllrMatrixDiagGmmDiagonal(), kaldi::ComputeFmllrMatrixDiagGmmFull(), kaldi::ComputeFmllrMatrixDiagGmmOffset(), MatrixBase< Real >::CopyFromMat(), MatrixBase< Real >::IsZero(), KALDI_ASSERT, KALDI_ERR, KALDI_WARN, FmllrOptions::min_count, FmllrOptions::num_iters, and FmllrOptions::update_type.
Referenced by main(), kaldi::UnitTestFmllrDiagGmm(), kaldi::UnitTestFmllrDiagGmmDiagonal(), and kaldi::UnitTestFmllrDiagGmmOffset().
|
private |
Definition at line 155 of file fmllr-diag-gmm.h.
Referenced by FmllrDiagGmmAccs::CommitSingleFrameStats().
|
private |