[mlpack-svn] r13217 - mlpack/trunk/src/mlpack/methods/sparse_coding
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Jul 12 10:46:11 EDT 2012
Author: rcurtin
Date: 2012-07-12 10:46:11 -0400 (Thu, 12 Jul 2012)
New Revision: 13217
Modified:
mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_main.cpp
Log:
Add parameters so user can specify objective and Newton tolerances.
Modified: mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_main.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_main.cpp 2012-07-12 13:48:15 UTC (rev 13216)
+++ mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_main.cpp 2012-07-12 14:46:11 UTC (rev 13217)
@@ -60,6 +60,11 @@
PARAM_INT("seed", "Random seed. If 0, 'std::time(NULL)' is used.", "s", 0);
+PARAM_DOUBLE("objective_tolerance", "Tolerance for convergence of the objective"
+ " function.", "o", 0.01);
+PARAM_DOUBLE("newton_tolerance", "Tolerance for convergence of Newton method.",
+ "w", 1e-6);
+
using namespace arma;
using namespace std;
using namespace mlpack;
@@ -89,6 +94,9 @@
const bool normalize = CLI::HasParam("normalize");
+ const double objTolerance = CLI::GetParam<double>("objective_tolerance");
+ const double newtonTolerance = CLI::GetParam<double>("newton_tolerance");
+
mat matX;
data::Load(inputFile, matX, true);
@@ -127,7 +135,7 @@
}
// Run sparse coding.
- sc.Encode(maxIterations);
+ sc.Encode(maxIterations, objTolerance, newtonTolerance);
// Save the results.
Log::Info << "Saving dictionary matrix to '" << dictionaryFile << "'.\n";
@@ -141,7 +149,7 @@
SparseCoding<> sc(matX, atoms, lambda1, lambda2);
// Run sparse coding.
- sc.Encode(maxIterations);
+ sc.Encode(maxIterations, objTolerance, newtonTolerance);
// Save the results.
Log::Info << "Saving dictionary matrix to '" << dictionaryFile << "'.\n";
More information about the mlpack-svn
mailing list