[mlpack-svn] r14806 - mlpack/trunk/src/mlpack/methods/gmm
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Apr 1 20:59:20 EDT 2013
Author: rcurtin
Date: 2013-04-01 20:59:19 -0400 (Mon, 01 Apr 2013)
New Revision: 14806
Modified:
mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp
Log:
Use GMM::Save() instead of a handwritten function.
Modified: mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp 2013-04-02 00:58:34 UTC (rev 14805)
+++ mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp 2013-04-02 00:59:19 UTC (rev 14806)
@@ -47,30 +47,13 @@
// Calculate mixture of Gaussians.
GMM<> gmm(size_t(gaussians), dataPoints.n_rows);
- ////// Computing the parameters of the model using the EM algorithm //////
+ // Compute the parameters of the model using the EM algorithm.
Timer::Start("em");
double likelihood = gmm.Estimate(dataPoints);
Timer::Stop("em");
Log::Info << "Log-likelihood of estimate: " << likelihood << ".\n";
- ////// OUTPUT RESULTS //////
- SaveRestoreUtility save;
- save.SaveParameter(gmm.Gaussians(), "gaussians");
- save.SaveParameter(gmm.Dimensionality(), "dimensionality");
- save.SaveParameter(trans(gmm.Weights()), "weights");
- for (size_t i = 0; i < gmm.Gaussians(); ++i)
- {
- // Generate names for the XML nodes.
- std::stringstream o;
- o << i;
- std::string meanName = "mean" + o.str();
- std::string covName = "covariance" + o.str();
-
- // Now save them.
- save.SaveParameter(trans(gmm.Means()[i]), meanName);
- save.SaveParameter(gmm.Covariances()[i], covName);
- }
-
- save.WriteFile(CLI::GetParam<std::string>("output_file"));
+ // Save results.
+ gmm.Save(CLI::GetParam<std::string>("output_file"));
}
More information about the mlpack-svn
mailing list