[mlpack] 138/149: Use maxIterations for Newton method loop instead of nested Armijo line search.

Barak A. Pearlmutter barak+git at pearlmutter.net
Sat May 2 09:11:18 UTC 2015


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit 2901b954cef96a27ebb21e034cd3ebc937280c0d
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Sat Dec 6 02:07:26 2014 +0000

    Use maxIterations for Newton method loop instead of nested Armijo line search.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17446 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 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 17d04fb..82179f6 100644
--- a/src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp
+++ b/src/mlpack/methods/sparse_coding/sparse_coding_impl.hpp
@@ -209,7 +209,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);
 
@@ -229,7 +229,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 = arma::sum(dualVars);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list