26 using namespace kaldi;
30 "Estimate LDA transform using stats obtained with acc-lda.\n" 31 "Usage: est-lda [options] <lda-matrix-out> <lda-acc-1> <lda-acc-2> ...\n";
34 std::string full_matrix_wxfilename;
37 po.Register(
"binary", &binary,
"Write matrix in binary mode.");
38 po.Register(
"write-full-matrix", &full_matrix_wxfilename,
39 "Write full LDA matrix to this location.");
43 if (po.NumArgs() < 2) {
49 std::string lda_mat_wxfilename = po.GetArg(1);
51 for (int32
i = 2;
i <= po.NumArgs();
i++) {
52 bool binary_in, add =
true;
53 Input ki(po.GetArg(
i), &binary_in);
54 lda.
Read(ki.Stream(), binary_in, add);
59 lda.
Estimate(opts, &lda_mat, &full_lda_mat);
61 if (full_matrix_wxfilename !=
"") {
62 Output ko(full_matrix_wxfilename, binary);
63 full_lda_mat.
Write(ko.Stream(), binary);
66 }
catch(
const std::exception &e) {
67 std::cerr << e.what();
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
void Write(std::ostream &out, bool binary) const
write to stream.
Class for computing linear discriminant analysis (LDA) transform.
void Estimate(const LdaEstimateOptions &opts, Matrix< BaseFloat > *M, Matrix< BaseFloat > *Mfull=NULL) const
Estimates the LDA transform matrix m.
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
void Read(std::istream &in_stream, bool binary, bool add)
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)
void Register(OptionsItf *opts)