#include <decodable-am-diag-gmm-regtree.h>
Public Member Functions | |
DecodableAmDiagGmmRegtreeMllr (const AmDiagGmm &am, const TransitionModel &tm, const Matrix< BaseFloat > &feats, const RegtreeMllrDiagGmm &mllr_xform, const RegressionTree ®tree, BaseFloat scale, BaseFloat log_sum_exp_prune=-1.0) | |
~DecodableAmDiagGmmRegtreeMllr () | |
virtual BaseFloat | LogLikelihood (int32 frame, int32 tid) |
Returns the log likelihood, which will be negated in the decoder. More... | |
virtual int32 | NumFramesReady () const |
The call NumFramesReady() will return the number of frames currently available for this decodable object. More... | |
virtual int32 | NumIndices () const |
Returns the number of states in the acoustic model (they will be indexed one-based, i.e. More... | |
const TransitionModel * | TransModel () |
Public Member Functions inherited from DecodableAmDiagGmmUnmapped | |
DecodableAmDiagGmmUnmapped (const AmDiagGmm &am, const Matrix< BaseFloat > &feats, BaseFloat log_sum_exp_prune=-1.0) | |
If you set log_sum_exp_prune to a value greater than 0 it will prune in the LogSumExp operation (larger = more exact); I suggest 5. More... | |
virtual bool | IsLastFrame (int32 frame) const |
Returns true if this is the last frame. More... | |
Public Member Functions inherited from DecodableInterface | |
virtual | ~DecodableInterface () |
Protected Member Functions | |
virtual BaseFloat | LogLikelihoodZeroBased (int32 frame, int32 state_index) |
Protected Member Functions inherited from DecodableAmDiagGmmUnmapped | |
void | ResetLogLikeCache () |
Private Member Functions | |
void | InitCache () |
Initializes the mean & gconst caches. More... | |
const Matrix< BaseFloat > & | GetXformedMeanInvVars (int32 state_index) |
Get the transformed means times inverse variances for a given pdf, and cache them. More... | |
const Vector< BaseFloat > & | GetXformedGconsts (int32 state_index) |
Get the cached (while computing transformed means) gconsts for likelihood calculation. More... | |
KALDI_DISALLOW_COPY_AND_ASSIGN (DecodableAmDiagGmmRegtreeMllr) | |
Private Attributes | |
const TransitionModel & | trans_model_ |
BaseFloat | scale_ |
const RegtreeMllrDiagGmm & | mllr_xform_ |
const RegressionTree & | regtree_ |
std::vector< Matrix< BaseFloat > *> | xformed_mean_invvars_ |
Cache of transformed means time inverse variances for each state. More... | |
std::vector< Vector< BaseFloat > *> | xformed_gconsts_ |
Cache of transformed gconsts for each state. More... | |
std::vector< bool > | is_cached_ |
Boolean variable per state to indicate whether the transformed means for that state are cached. More... | |
Vector< BaseFloat > | data_squared_ |
Cached for fast likelihood calculation. More... | |
Additional Inherited Members | |
Protected Attributes inherited from DecodableAmDiagGmmUnmapped | |
const AmDiagGmm & | acoustic_model_ |
const Matrix< BaseFloat > & | feature_matrix_ |
int32 | previous_frame_ |
BaseFloat | log_sum_exp_prune_ |
std::vector< LikelihoodCacheRecord > | log_like_cache_ |
Definition at line 80 of file decodable-am-diag-gmm-regtree.h.
|
inline |
Definition at line 82 of file decodable-am-diag-gmm-regtree.h.
Definition at line 91 of file decodable-am-diag-gmm-regtree.cc.
References kaldi::DeletePointers().
Get the cached (while computing transformed means) gconsts for likelihood calculation.
The 'state_index' is 0-based.
Definition at line 180 of file decodable-am-diag-gmm-regtree.cc.
References KALDI_ASSERT, and KALDI_ERR.
Get the transformed means times inverse variances for a given pdf, and cache them.
The 'state_index' is 0-based.
Definition at line 151 of file decodable-am-diag-gmm-regtree.cc.
References DecodableAmDiagGmmUnmapped::acoustic_model_, kaldi::ComputeGconsts(), AmDiagGmm::Dim(), AmDiagGmm::GetPdf(), DiagGmm::inv_vars(), KALDI_ASSERT, KALDI_VLOG, DiagGmm::NumGauss(), DecodableAmDiagGmmRegtreeFmllr::regtree_, and DiagGmm::weights().
|
private |
Initializes the mean & gconst caches.
Definition at line 97 of file decodable-am-diag-gmm-regtree.cc.
References DecodableAmDiagGmmUnmapped::acoustic_model_, kaldi::DeletePointers(), AmDiagGmm::NumPdfs(), and DecodableAmDiagGmmUnmapped::ResetLogLikeCache().
|
private |
Returns the log likelihood, which will be negated in the decoder.
The "frame" starts from zero. You should verify that NumFramesReady() > frame before calling this.
Reimplemented from DecodableAmDiagGmmUnmapped.
Definition at line 95 of file decodable-am-diag-gmm-regtree.h.
References DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), DecodableAmDiagGmmRegtreeFmllr::scale_, DecodableAmDiagGmmRegtreeFmllr::trans_model_, and TransitionModel::TransitionIdToPdfFast().
Reimplemented from DecodableAmDiagGmmUnmapped.
Definition at line 190 of file decodable-am-diag-gmm-regtree.cc.
References DecodableAmDiagGmmUnmapped::acoustic_model_, VectorBase< Real >::AddMatVec(), DecodableAmDiagGmmUnmapped::data_squared_, VectorBase< Real >::Dim(), DiagGmm::Dim(), DecodableAmDiagGmmUnmapped::feature_matrix_, AmDiagGmm::GetPdf(), DiagGmm::inv_vars(), KALDI_ASSERT, KALDI_ERR, KALDI_ISINF, KALDI_ISNAN, kaldi::kNoTrans, DecodableAmDiagGmmUnmapped::log_like_cache_, DecodableAmDiagGmmUnmapped::log_sum_exp_prune_, VectorBase< Real >::LogSumExp(), DecodableAmDiagGmmRegtreeFmllr::NumFramesReady(), DecodableAmDiagGmmRegtreeFmllr::NumIndices(), DecodableAmDiagGmmUnmapped::previous_frame_, and MatrixBase< Real >::Row().
|
inlinevirtual |
The call NumFramesReady() will return the number of frames currently available for this decodable object.
This is for use in setups where you don't want the decoder to block while waiting for input. This is newly added as of Jan 2014, and I hope, going forward, to rely on this mechanism more than IsLastFrame to know when to stop decoding.
Reimplemented from DecodableAmDiagGmmUnmapped.
Definition at line 100 of file decodable-am-diag-gmm-regtree.h.
References DecodableAmDiagGmmUnmapped::feature_matrix_, and MatrixBase< Real >::NumRows().
Referenced by main().
|
inlinevirtual |
Returns the number of states in the acoustic model (they will be indexed one-based, i.e.
from 1 to NumIndices(); this is for compatibility with OpenFst).
Reimplemented from DecodableAmDiagGmmUnmapped.
Definition at line 103 of file decodable-am-diag-gmm-regtree.h.
References TransitionModel::NumTransitionIds(), and DecodableAmDiagGmmRegtreeFmllr::trans_model_.
|
inline |
Definition at line 105 of file decodable-am-diag-gmm-regtree.h.
References DecodableAmDiagGmmRegtreeFmllr::LogLikelihoodZeroBased(), and DecodableAmDiagGmmRegtreeFmllr::trans_model_.
Cached for fast likelihood calculation.
Definition at line 134 of file decodable-am-diag-gmm-regtree.h.
|
private |
Boolean variable per state to indicate whether the transformed means for that state are cached.
Definition at line 132 of file decodable-am-diag-gmm-regtree.h.
|
private |
Definition at line 122 of file decodable-am-diag-gmm-regtree.h.
|
private |
Definition at line 123 of file decodable-am-diag-gmm-regtree.h.
|
private |
Definition at line 121 of file decodable-am-diag-gmm-regtree.h.
|
private |
Definition at line 120 of file decodable-am-diag-gmm-regtree.h.
Cache of transformed gconsts for each state.
Definition at line 129 of file decodable-am-diag-gmm-regtree.h.
Cache of transformed means time inverse variances for each state.
Definition at line 127 of file decodable-am-diag-gmm-regtree.h.