[mlpack-git] master: Use maxIterations for Newton method loop instead of nested Armijo line search. (c0da3d0)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:04:42 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit c0da3d0e673356ec94a1cf09a5c3a9e2b8fc6162
Author: Ryan Curtin <ryan at ratml.org>
Date: Sat Dec 6 02:07:26 2014 +0000
Use maxIterations for Newton method loop instead of nested Armijo line search.
>---------------------------------------------------------------
c0da3d0e673356ec94a1cf09a5c3a9e2b8fc6162
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);
More information about the mlpack-git
mailing list