[mlpack-git] mlpack-1.0.x: Backport r17446, the most recent fix. Phew. I'm done with this backporting process (...for now). Hooray! (9ea8653)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Jan 7 11:57:54 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/0000000000000000000000000000000000000000...904762495c039e345beba14c1142fd719b3bd50e

>---------------------------------------------------------------

commit 9ea86537c73c74c400a5c2645eb780449fe834d1
Author: Ryan Curtin <ryan at ratml.org>
Date:   Sun Dec 7 19:48:53 2014 +0000

    Backport r17446, the most recent fix. Phew. I'm done with this backporting process (...for now). Hooray!


>---------------------------------------------------------------

9ea86537c73c74c400a5c2645eb780449fe834d1
 src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp b/src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp
index 6ec6fda..f678796 100644
--- a/src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp
+++ b/src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp
@@ -224,7 +224,7 @@ double SparseCoding<DictionaryInitializer>::OptimizeDictionary(
 
   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);
 
@@ -244,7 +244,9 @@ double SparseCoding<DictionaryInitializer>::OptimizeDictionary(
     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 = sum(dualVars);



More information about the mlpack-git mailing list