From 8a8b708650f72c2aecbd9b4a12c8b16b4e0a3508 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 29 Sep 2015 09:54:31 -0400 Subject: [PATCH] Set initial parameters correctly; restore tolerances. --- 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 e1e57c7c4d..38cded206b 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 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); } }