[mlpack-svn] r17446 - mlpack/trunk/src/mlpack/methods/sparse_coding

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Dec 5 21:07:26 EST 2014


Author: rcurtin
Date: Fri Dec  5 21:07:26 2014
New Revision: 17446

Log:
Use maxIterations for Newton method loop instead of nested Armijo line search.


Modified:
   mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp

Modified: mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp	Fri Dec  5 21:07:26 2014
@@ -209,7 +209,7 @@
 
   double normGradient;
   double improvement = 0;
-  for (size_t t = 1; !converged; ++t)
+  for (size_t t = 1; (t != maxIterations) && !converged; ++t)
   {
     arma::mat A = codesZT + diagmat(dualVars);
 
@@ -229,7 +229,9 @@
     const double rho = 0.9;
     double sufficientDecrease = c * dot(gradient, searchDirection);
 
-    for (size_t t = 1; t != maxIterations; ++t)
+    // A maxIterations parameter for the Armijo line search may be a good idea,
+    // but it doesn't seem to be causing any problems for now.
+    while (true)
     {
       // Calculate objective.
       double sumDualVars = arma::sum(dualVars);



More information about the mlpack-svn mailing list