[mlpack-svn] r16696 - mlpack/trunk/src/mlpack/methods/amf

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Jun 23 17:38:42 EDT 2014


Author: rcurtin
Date: Mon Jun 23 17:38:42 2014
New Revision: 16696

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


Modified:
   mlpack/trunk/src/mlpack/methods/amf/amf_impl.hpp

Modified: mlpack/trunk/src/mlpack/methods/amf/amf_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/amf/amf_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/amf/amf_impl.hpp	Mon Jun 23 17:38:42 2014
@@ -63,7 +63,7 @@
 
   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-svn mailing list