27   using namespace kaldi;
    31         "Trains a model using Logistic Regression with L-BFGS from\n"    32         "a set of vectors. The class labels in <classes-rspecifier>\n"    33         "must be a set of integers such that there are no gaps in \n"    34         "its range and the smallest label must be 0.\n"    35         "Usage: logistic-regression-train <vector-rspecifier>\n"    36         "<classes-rspecifier> <model-out>\n";
    43     po.Register(
"binary", &binary, 
"Write output in binary mode");
    46     if (po.NumArgs() != 3) {
    51     std::string vector_rspecifier = po.GetArg(1),
    52         class_rspecifier = po.GetArg(2),
    53         model_out = po.GetArg(3);
    58     std::vector<int32> ys;
    59     std::vector<std::string> utt_ids;
    60     std::vector<Vector<BaseFloat> > vectors;
    62     int32 num_utt_done = 0, num_utt_err = 0;
    64     int32 num_classes = 0;
    65     for (; !class_reader.Done(); class_reader.Next()) {
    66       std::string utt = class_reader.Key();
    67       int32 class_label = class_reader.Value();
    68       if (!vector_reader.HasKey(utt)) {
    69         KALDI_WARN << 
"No vector for utterance " << utt;
    72         ys.push_back(class_label);
    74         vectors.push_back(vector);
    79         if (class_label > num_classes) {
    80           num_classes = class_label;
    90     KALDI_LOG << 
"Retrieved " << num_utt_done << 
" vectors with "    91               << num_utt_err << 
" missing. "    92               << 
"There were " << num_classes << 
" class labels.";
    94     if (num_utt_done == 0)
    95       KALDI_ERR << 
"No vectors processed. Unable to train.";
    98     for (
int i = 0; 
i < vectors.size(); 
i++) {
    99       xs.
Row(
i).CopyFromVec(vectors[
i]);
   104     classifier.
Train(xs, ys, config);
   108   } 
catch(
const std::exception &e) {
   109     std::cerr << e.what();
 This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
 
void Train(const Matrix< BaseFloat > &xs, const std::vector< int32 > &ys, const LogisticRegressionConfig &conf)
 
Allows random access to a collection of objects in an archive or script file; see The Table concept...
 
The class ParseOptions is for parsing command-line options; see Parsing command-line options for more...
 
const SubVector< Real > Row(MatrixIndexT i) const
Return specific row of matrix [const]. 
 
A templated class for reading objects sequentially from an archive or script file; see The Table conc...
 
void Register(OptionsItf *opts)
 
A class representing a vector. 
 
void WriteKaldiObject(const C &c, const std::string &filename, bool binary)