[mlpack-git] master, mlpack-1.0.x: Fix for convergence, because sometimes the residue may increase (especially with ALS update rules). (d559ce3)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:49:14 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 d559ce3d837cc1afff0a5f902c8cef28914ee63a
Author: Ryan Curtin <ryan at ratml.org>
Date:   Mon Jun 23 21:38:42 2014 +0000

    Fix for convergence, because sometimes the residue may increase (especially with
    ALS update rules).


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

d559ce3d837cc1afff0a5f902c8cef28914ee63a
 src/mlpack/methods/amf/amf_impl.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mlpack/methods/amf/amf_impl.hpp b/src/mlpack/methods/amf/amf_impl.hpp
index 2bd0ee9..9ee69a4 100644
--- a/src/mlpack/methods/amf/amf_impl.hpp
+++ b/src/mlpack/methods/amf/amf_impl.hpp
@@ -63,7 +63,7 @@ double AMF<InitializationRule, UpdateRule>::Apply(
 
   update.Initialize(V, r);
 
-  while (((oldResidue - residue) / oldResidue >= tolerance || iteration < 4) && iteration != maxIterations)
+  while ((std::abs(oldResidue - residue) / oldResidue >= tolerance || iteration < 4) && iteration != maxIterations)
   {
     // Update step.
     // Update the value of W and H based on the Update Rules provided



More information about the mlpack-git mailing list