[mlpack-git] master: Hierchical model support (8739905)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:56:27 EST 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

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

commit 8739905730f1af85db0d798ec691f7af5eecef96
Author: michaelfox99 <michaelfox99 at gmail.com>
Date:   Tue Aug 5 13:31:54 2014 +0000

    Hierchical model support


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

8739905730f1af85db0d798ec691f7af5eecef96
 src/mlpack/methods/hmm/hmm_generate_main.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/mlpack/methods/hmm/hmm_generate_main.cpp b/src/mlpack/methods/hmm/hmm_generate_main.cpp
index 23a58f1..566e88d 100644
--- a/src/mlpack/methods/hmm/hmm_generate_main.cpp
+++ b/src/mlpack/methods/hmm/hmm_generate_main.cpp
@@ -1,6 +1,7 @@
 /**
- * @file hmm_viterbi_main.cpp
+ * @file hmm_generate_main.cpp
  * @author Ryan Curtin
+ * @author Michael Fox
  *
  * Compute the most probably hidden state sequence of a given observation
  * sequence for a given HMM.
@@ -62,16 +63,15 @@ int main(int argc, char** argv)
   // Load model, but first we have to determine its type.
   SaveRestoreUtility sr;
   sr.ReadFile(modelFile);
-  string type;
-  sr.LoadParameter(type, "hmm_type");
+  string emissionType;
+  sr.LoadParameter(emissionType, "emission_type");
 
   mat observations;
   Col<size_t> sequence;
-  if (type == "discrete")
+  if (emissionType == "DiscreteDistribution")
   {
     HMM<DiscreteDistribution> hmm(1, DiscreteDistribution(1));
-
-    LoadHMM(hmm, sr);
+    hmm.Load(sr);
 
     if (startState < 0 || startState >= (int) hmm.Transition().n_rows)
     {
@@ -82,11 +82,10 @@ int main(int argc, char** argv)
 
     hmm.Generate(size_t(length), observations, sequence, size_t(startState));
   }
-  else if (type == "gaussian")
+  else if (emissionType == "GaussianDistribution")
   {
     HMM<GaussianDistribution> hmm(1, GaussianDistribution(1));
-
-    LoadHMM(hmm, sr);
+    hmm.Load(sr);
 
     if (startState < 0 || startState >= (int) hmm.Transition().n_rows)
     {
@@ -97,11 +96,10 @@ int main(int argc, char** argv)
 
     hmm.Generate(size_t(length), observations, sequence, size_t(startState));
   }
-  else if (type == "gmm")
+  else if (emissionType == "GMM")
   {
     HMM<GMM<> > hmm(1, GMM<>(1, 1));
-
-    LoadHMM(hmm, sr);
+    hmm.Load(sr);
 
     if (startState < 0 || startState >= (int) hmm.Transition().n_rows)
     {
@@ -114,7 +112,7 @@ int main(int argc, char** argv)
   }
   else
   {
-    Log::Fatal << "Unknown HMM type '" << type << "' in file '" << modelFile
+    Log::Fatal << "Unknown HMM type '" << emissionType << "' in file '" << modelFile
         << "'!" << endl;
   }
 
@@ -126,4 +124,6 @@ int main(int argc, char** argv)
   const string sequenceFile = CLI::GetParam<string>("state_file");
   if (sequenceFile != "")
     data::Save(sequenceFile, sequence, true);
+  
+  return 0;
 }



More information about the mlpack-git mailing list