30 using namespace kaldi;
38 accs.
Init(am_gmm, flags);
44 KALDI_LOG <<
"Data log-likelihood = " << loglike <<
" over " 45 << feats.
NumRows() <<
" frames.";
47 <<
", # frames = " << accs.
TotCount();
99 int32 total_num_comp = 0;
100 for (
int32 i = 0;
i < num_pdfs;
i++) {
105 total_num_comp += num_comp;
114 vars(num_feat_comp, dim);
115 for (
int32 m = 0; m < num_feat_comp; m++) {
122 feats.
Resize(num_feat_comp * 200, dim);
123 for (
int32 m = 0; m < num_feat_comp; m++) {
134 for (
int i = 0;
i < 10;
i++)
136 std::cout <<
"Test OK.\n";
void MleAmDiagGmmUpdate(const MleDiagGmmOptions &config, const AccumAmDiagGmm &am_diag_gmm_acc, GmmFlagsType flags, AmDiagGmm *am_gmm, BaseFloat *obj_change_out, BaseFloat *count_out)
for computing the maximum-likelihood estimates of the parameters of an acoustic model that uses diago...
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void CopyFromAmDiagGmm(const AmDiagGmm &other)
Copies the parameters from another model. Allocates necessary memory.
void AddPdf(const DiagGmm &gmm)
Adds a GMM to the model, and increments the total number of PDFs.
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.
float RandGauss(struct RandomState *state=NULL)
BaseFloat TotCount() const
uint16 GmmFlagsType
Bitwise OR of the above flags.
BaseFloat TotLogLike() const
const SubVector< Real > Row(MatrixIndexT i) const
Return specific row of matrix [const].
BaseFloat LogLikelihood(const int32 pdf_index, const VectorBase< BaseFloat > &data) const
void InitRandDiagGmm(int32 dim, int32 num_comp, DiagGmm *gmm)
Configuration variables like variance floor, minimum occupancy, etc.
void Read(std::istream &in_stream, bool binary, bool add=false)
MatrixIndexT NumRows() const
Returns number of rows (or zero for empty matrix).
void Write(std::ostream &out_stream, bool binary) const
static void AssertEqual(float a, float b, float relative_tolerance=0.001)
assert abs(a - b) <= relative_tolerance * (abs(a)+abs(b))
Definition for Gaussian Mixture Model with diagonal covariances.
void RandDiagGaussFeatures(int32 num_samples, const VectorBase< BaseFloat > &mean, const VectorBase< BaseFloat > &sqrt_var, MatrixBase< BaseFloat > *feats)
void Resize(const MatrixIndexT r, const MatrixIndexT c, MatrixResizeType resize_type=kSetZero, MatrixStrideType stride_type=kDefaultStride)
Sets matrix to a specified size (zero is OK as long as both r and c are zero).
void TestAmDiagGmmAccsIO(const AmDiagGmm &am_gmm, const Matrix< BaseFloat > &feats)
void Init(const AmDiagGmm &model, GmmFlagsType flags)
Initializes accumulators for each GMM based on the number of components and dimension.
Sub-matrix representation.
void UnitTestMleAmDiagGmm()
int32 RandInt(int32 min_val, int32 max_val, struct RandomState *state)