[mlpack-git] master, mlpack-1.0.x: Patch from Zhihao: sa_update.diff. (9222526)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:52:02 EST 2015


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

On branches: master,mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

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

commit 9222526ec2d7f24b2d17c9db8f74366618746fbc
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Jul 8 12:50:36 2014 +0000

    Patch from Zhihao: sa_update.diff.


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

9222526ec2d7f24b2d17c9db8f74366618746fbc
 src/mlpack/core/optimizers/sa/sa_impl.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/core/optimizers/sa/sa_impl.hpp b/src/mlpack/core/optimizers/sa/sa_impl.hpp
index fdab618..62bd139 100644
--- a/src/mlpack/core/optimizers/sa/sa_impl.hpp
+++ b/src/mlpack/core/optimizers/sa/sa_impl.hpp
@@ -59,7 +59,7 @@ double SA<FunctionType, CoolingScheduleType>::Optimize(arma::mat &iterate)
 
   size_t frozenCount = 0;
   double energy = function.Evaluate(iterate);
-  size_t oldEnergy = energy;
+  double oldEnergy = energy;
   math::RandomSeed(std::time(NULL));
 
   size_t idx = 0;
@@ -87,7 +87,7 @@ double SA<FunctionType, CoolingScheduleType>::Optimize(arma::mat &iterate)
       frozenCount = 0;
 
     // Terminate, if possible.
-    if (frozenCount >= maxToleranceSweep * iterate.n_elem)
+    if (frozenCount >= maxToleranceSweep * moveCtrlSweep * iterate.n_elem)
     {
       Log::Debug << "SA: minimized within tolerance " << tolerance << " for "
           << maxToleranceSweep << " sweeps after " << i << " iterations; "



More information about the mlpack-git mailing list