[mlpack-svn] r17083 - mlpack/trunk/src/mlpack/methods/gmm

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Aug 20 11:03:06 EDT 2014


Author: rcurtin
Date: Wed Aug 20 11:03:04 2014
New Revision: 17083

Log:
Formatting fixes for GMM conversion utility.


Modified:
   mlpack/trunk/src/mlpack/methods/gmm/gmm_convert_main.cpp

Modified: mlpack/trunk/src/mlpack/methods/gmm/gmm_convert_main.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/gmm/gmm_convert_main.cpp	(original)
+++ mlpack/trunk/src/mlpack/methods/gmm/gmm_convert_main.cpp	Wed Aug 20 11:03:04 2014
@@ -7,34 +7,32 @@
 #include <mlpack/core.hpp>
 #include "gmm.hpp"
 
-
 using namespace mlpack;
 using namespace mlpack::gmm;
 using namespace mlpack::util;
 using namespace std;
 
 PROGRAM_INFO("Gaussian Mixture Model (GMM) file converter",
-    "This program takes a fitted GMM XML file from older MLPACK versions and "
-		"converts it to the current format.");
+    "This program takes a fitted GMM XML file from older MLPACK versions (1.0.9"
+    " and older) and converts it to the current format.");
 
-PARAM_STRING_REQ("input_file", "File containing the fitted model ", "i");
+PARAM_STRING_REQ("input_file", "File containing the fitted model.", "i");
 PARAM_STRING("output_file", "The file to write the model to (as XML).", "o",
     "gmm.xml");
 
 int main(int argc, char* argv[])
 {
   CLI::ParseCommandLine(argc, argv);
-	string inputFile = CLI::GetParam<string>("input_file");
-  //data::Load(CLI::GetParam<string>("input_file"), inputFile, true);
-	util::SaveRestoreUtility load;
+  string inputFile = CLI::GetParam<string>("input_file");
+  SaveRestoreUtility load;
 
   if (!load.ReadFile(inputFile))
     Log::Fatal << " Could not read file '" << inputFile << "'!\n";
-	
-	size_t gaussians, dimensionality;
-	load.LoadParameter(gaussians, "gaussians");
+
+  size_t gaussians, dimensionality;
+  load.LoadParameter(gaussians, "gaussians");
   load.LoadParameter(dimensionality, "dimensionality");
-	GMM<> gmm(gaussians, dimensionality);
+  GMM<> gmm(gaussians, dimensionality);
 
   load.LoadParameter(gmm.Weights(), "weights");
 
@@ -42,22 +40,20 @@
   if (gmm.Weights().n_elem != gmm.Gaussians())
   {
     Log::Fatal << "GMM::Load('" << inputFile << "'): file reports "
-				<< gmm.Gaussians() << " gaussians but weights vector only contains "
-				<< gmm.Weights().n_elem << " elements!" << std::endl;
+        << gmm.Gaussians() << " gaussians but weights vector only contains "
+        << gmm.Weights().n_elem << " elements!" << endl;
   }
 
-  
   for (size_t i = 0; i < gaussians; ++i)
   {
-    std::stringstream o;
+    stringstream o;
     o << i;
-    std::string meanName = "mean" + o.str();
-    std::string covName = "covariance" + o.str();
+    string meanName = "mean" + o.str();
+    string covName = "covariance" + o.str();
 
     load.LoadParameter(gmm.Component(i).Mean(), meanName);
     load.LoadParameter(gmm.Component(i).Covariance(), covName);
   }
-	
-	gmm.Save(CLI::GetParam<string>("output_file"));
-	
+
+  gmm.Save(CLI::GetParam<string>("output_file"));
 }



More information about the mlpack-svn mailing list