[mlpack-git] master: Use easier-to-understand isnan(). (ecf36c5)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Mon Oct 19 07:54:12 EDT 2015


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

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/6e86d1070e4578551939410f8bf0bca71fbd89bb...ecf36c506a17b5f91f0d502a08e08075f8b0a024

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

commit ecf36c506a17b5f91f0d502a08e08075f8b0a024
Author: ryan <ryan at ratml.org>
Date:   Mon Oct 19 07:53:59 2015 -0400

    Use easier-to-understand isnan().


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

ecf36c506a17b5f91f0d502a08e08075f8b0a024
 src/mlpack/core/optimizers/sgd/sgd_impl.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mlpack/core/optimizers/sgd/sgd_impl.hpp b/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
index 9c1f4ef..9b9a6e3 100644
--- a/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
+++ b/src/mlpack/core/optimizers/sgd/sgd_impl.hpp
@@ -60,7 +60,7 @@ double SGD<DecomposableFunctionType>::Optimize(arma::mat& iterate)
       Log::Info << "SGD: iteration " << i << ", objective " << overallObjective
           << "." << std::endl;
 
-      if (overallObjective != overallObjective)
+      if (std::isnan(overallObjective))
       {
         Log::Warn << "SGD: converged to " << overallObjective << "; terminating"
             << " with failure.  Try a smaller step size?" << std::endl;



More information about the mlpack-git mailing list