[mlpack-git] master: Use CLI parameters correctly. (713fa60)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Nov 19 11:35:08 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/713fa60a06f709bc715c4dd88f6ba585796f73a0...319205b2f3103187c584db302b1a3683aa2fbfdf

>---------------------------------------------------------------

commit 713fa60a06f709bc715c4dd88f6ba585796f73a0
Author: Ryan Curtin <ryan at ratml.org>
Date:   Wed Nov 18 09:01:47 2015 -0800

    Use CLI parameters correctly.


>---------------------------------------------------------------

713fa60a06f709bc715c4dd88f6ba585796f73a0
 src/mlpack/methods/hmm/hmm_train_main.cpp | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/mlpack/methods/hmm/hmm_train_main.cpp b/src/mlpack/methods/hmm/hmm_train_main.cpp
index 20060c3..00057dd 100644
--- a/src/mlpack/methods/hmm/hmm_train_main.cpp
+++ b/src/mlpack/methods/hmm/hmm_train_main.cpp
@@ -18,8 +18,8 @@ PROGRAM_INFO("Hidden Markov Model (HMM) Training", "This program allows a "
     "Either one input sequence can be specified (with --input_file), or, a "
     "file containing files in which input sequences can be found (when "
     "--input_file and --batch are used together).  In addition, labels can be "
-    "provided in the file specified by --label_file, and if --batch is used, "
-    "the file given to --label_file should contain a list of files of labels "
+    "provided in the file specified by --labels_file, and if --batch is used, "
+    "the file given to --labels_file should contain a list of files of labels "
     "corresponding to the sequences in the file given to --input_file."
     "\n\n"
     "The HMM is trained with the Baum-Welch algorithm if no labels are "
@@ -43,7 +43,7 @@ PARAM_INT("gaussians", "Number of gaussians in each GMM (necessary when type is"
 PARAM_STRING("model_file", "Pre-existing HMM model (optional).", "m", "");
 PARAM_STRING("labels_file", "Optional file of hidden states, used for "
     "labeled training.", "l", "");
-PARAM_STRING("output_file", "File to save trained HMM to.", "o",
+PARAM_STRING("output_model_file", "File to save trained HMM to.", "o",
     "output_hmm.xml");
 PARAM_INT("seed", "Random seed.  If 0, 'std::time(NULL)' is used.", "s", 0);
 PARAM_DOUBLE("tolerance", "Tolerance of the Baum-Welch algorithm.", "T", 1e-5);
@@ -152,8 +152,11 @@ struct Train
     }
 
     // Save the model.
-    const string modelFile = CLI::GetParam<string>("model_file");
-    SaveHMM(hmm, modelFile);
+    if (CLI::HasParam("output_model_file"))
+    {
+      const string modelFile = CLI::GetParam<string>("output_model_file");
+      SaveHMM(hmm, modelFile);
+    }
   }
 };
 
@@ -310,7 +313,7 @@ int main(int argc, char** argv)
           tolerance);
 
       // Issue a warning if the user didn't give labels.
-      if (!CLI::HasParam("label_file"))
+      if (!CLI::HasParam("labels_file"))
         Log::Warn << "Unlabeled training of GMM HMMs is almost certainly not "
             << "going to produce good results!" << endl;
 



More information about the mlpack-git mailing list