[mlpack-git] master: Set initial parameters correctly; restore tolerances. (8a8b708)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Tue Sep 29 09:54:57 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/f85a9b22f3ce56143943a2488c05c2810d6b2bf3...8a8b708650f72c2aecbd9b4a12c8b16b4e0a3508
>---------------------------------------------------------------
commit 8a8b708650f72c2aecbd9b4a12c8b16b4e0a3508
Author: ryan <ryan at ratml.org>
Date: Tue Sep 29 09:54:31 2015 -0400
Set initial parameters correctly; restore tolerances.
>---------------------------------------------------------------
8a8b708650f72c2aecbd9b4a12c8b16b4e0a3508
src/mlpack/tests/softmax_regression_test.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/mlpack/tests/softmax_regression_test.cpp b/src/mlpack/tests/softmax_regression_test.cpp
index e1e57c7..38cded2 100644
--- a/src/mlpack/tests/softmax_regression_test.cpp
+++ b/src/mlpack/tests/softmax_regression_test.cpp
@@ -394,6 +394,7 @@ BOOST_AUTO_TEST_CASE(SoftmaxRegressionOptimizerTrainTest)
SoftmaxRegression<> sr2(dataset.n_rows, 2, true);
L_BFGS<SoftmaxRegressionFunction> lbfgs2(srf);
+ sr2.Parameters() = srf.GetInitialPoint();
sr2.Train(lbfgs2);
// Ensure that the parameters are the same.
@@ -401,10 +402,10 @@ BOOST_AUTO_TEST_CASE(SoftmaxRegressionOptimizerTrainTest)
BOOST_REQUIRE_EQUAL(sr.Parameters().n_cols, sr2.Parameters().n_cols);
for (size_t i = 0; i < sr.Parameters().n_elem; ++i)
{
- if (std::abs(sr.Parameters()[i]) < 0.01)
- BOOST_REQUIRE_SMALL(sr2.Parameters()[i], 0.01);
+ if (std::abs(sr.Parameters()[i]) < 1e-5)
+ BOOST_REQUIRE_SMALL(sr2.Parameters()[i], 1e-5);
else
- BOOST_REQUIRE_CLOSE(sr.Parameters()[i], sr2.Parameters()[i], 0.01);
+ BOOST_REQUIRE_CLOSE(sr.Parameters()[i], sr2.Parameters()[i], 1e-5);
}
}
More information about the mlpack-git
mailing list