[mlpack] 129/149: Handle negative gradient values correctly.
Barak A. Pearlmutter
barak+git at pearlmutter.net
Sat May 2 09:11:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch svn-trunk
in repository mlpack.
commit f894bde22535a8409af06c66d6a7df5ea3ab717b
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Tue Dec 2 18:25:46 2014 +0000
Handle negative gradient values correctly.
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17429 9d5b8971-822b-0410-80eb-d18c1038ef23
---
src/mlpack/tests/regularized_svd_test.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mlpack/tests/regularized_svd_test.cpp b/src/mlpack/tests/regularized_svd_test.cpp
index 06e9e8c..1cbb741 100644
--- a/src/mlpack/tests/regularized_svd_test.cpp
+++ b/src/mlpack/tests/regularized_svd_test.cpp
@@ -176,12 +176,12 @@ BOOST_AUTO_TEST_CASE(RegularizedSVDFunctionGradient)
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);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list