[mlpack-svn] r11164 - mlpack/trunk/src/mlpack/methods/gmm
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Jan 19 11:35:18 EST 2012
Author: rcurtin
Date: 2012-01-19 11:35:17 -0500 (Thu, 19 Jan 2012)
New Revision: 11164
Modified:
mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp
Log:
Add option for random seed (for #182).
Modified: mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp 2012-01-19 16:33:22 UTC (rev 11163)
+++ mlpack/trunk/src/mlpack/methods/gmm/gmm_main.cpp 2012-01-19 16:35:17 UTC (rev 11164)
@@ -14,9 +14,10 @@
PARAM_STRING_REQ("input_file", "File containing the data on which the model "
"will be fit.", "i");
-PARAM_INT("gaussians", "Number of Gaussians in the GMM", "g", 1);
+PARAM_INT("gaussians", "Number of Gaussians in the GMM.", "g", 1);
PARAM_STRING("output_file", "The file to write the trained GMM parameters into "
"(as XML).", "o", "gmm.xml");
+PARAM_INT("seed", "Random seed. If 0, 'std::time(NULL)' is used.", "s", 0);
using namespace mlpack;
using namespace mlpack::gmm;
@@ -27,6 +28,11 @@
CLI::ParseCommandLine(argc, argv);
// Check parameters and load data.
+ if (CLI::GetParam<int>("seed") != 0)
+ math::RandomSeed((size_t) CLI::GetParam<int>("seed"));
+ else
+ math::RandomSeed((size_t) std::time(NULL));
+
arma::mat dataPoints;
data::Load(CLI::GetParam<std::string>("input_file").c_str(), dataPoints,
true);
More information about the mlpack-svn
mailing list