[mlpack] 28/58: Formatting fixes for GMM conversion utility.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Tue Sep 9 13:19:41 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit 802b153cfd8b0de8b9eb8b06578320b6f8d5a3c5
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Wed Aug 20 15:03:04 2014 +0000

    Formatting fixes for GMM conversion utility.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17083 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/methods/gmm/gmm_convert_main.cpp | 36 +++++++++++++----------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/src/mlpack/methods/gmm/gmm_convert_main.cpp b/src/mlpack/methods/gmm/gmm_convert_main.cpp
index e7fb0f9..7d80ebd 100644
--- a/src/mlpack/methods/gmm/gmm_convert_main.cpp
+++ b/src/mlpack/methods/gmm/gmm_convert_main.cpp
@@ -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 @@ int main(int argc, char* argv[])
   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"));
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list