[mlpack-svn] r17429 - mlpack/trunk/src/mlpack/tests
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Dec 2 13:25:47 EST 2014
Author: rcurtin
Date: Tue Dec 2 13:25:46 2014
New Revision: 17429
Log:
Handle negative gradient values correctly.
Modified:
mlpack/trunk/src/mlpack/tests/regularized_svd_test.cpp
Modified: mlpack/trunk/src/mlpack/tests/regularized_svd_test.cpp
==============================================================================
--- mlpack/trunk/src/mlpack/tests/regularized_svd_test.cpp (original)
+++ mlpack/trunk/src/mlpack/tests/regularized_svd_test.cpp Tue Dec 2 13:25:46 2014
@@ -176,12 +176,12 @@
parameters(i, j) += epsilon;
// Compare numerical and backpropagation gradient values.
- if (gradient1(i, j) <= 1e-6)
+ if (std::abs(gradient1(i, j)) <= 1e-6)
BOOST_REQUIRE_SMALL(numGradient1, 1e-5);
else
BOOST_REQUIRE_CLOSE(numGradient1, gradient1(i, j), 1e-2);
- if (gradient2(i, j) <= 1e-6)
+ if (std::abs(gradient2(i, j)) <= 1e-6)
BOOST_REQUIRE_SMALL(numGradient2, 1e-5);
else
BOOST_REQUIRE_CLOSE(numGradient2, gradient2(i, j), 1e-2);
More information about the mlpack-svn
mailing list