From f215a8fdd4ae751a4bc3b92b57d4a1fca673e4f5 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Tue, 8 Nov 2011 04:08:48 +0000 Subject: [PATCH] Use BOOST_REQUIRE_CLOSE instead of just plain assert(). --- src/mlpack/tests/linear_regression_test.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mlpack/tests/linear_regression_test.cpp b/src/mlpack/tests/linear_regression_test.cpp index 0f95bc0a79..30f8aa1200 100644 --- a/src/mlpack/tests/linear_regression_test.cpp +++ b/src/mlpack/tests/linear_regression_test.cpp @@ -3,7 +3,7 @@ #include -BOOST_AUTO_TEST_SUITE(LinearRegressonTest); +BOOST_AUTO_TEST_SUITE(LinearRegressionTest); /** * Creates two 10x3 random matrices and one 10x1 "results" matrix. @@ -42,13 +42,10 @@ BOOST_AUTO_TEST_SUITE(LinearRegressonTest); mlpack::linear_regression::LinearRegression lr(predictors, responses); lr.predict(predictions, points); - // Output result and verify we have less than .5 error from "correct" value + // Output result and verify we have less than 35% error from "correct" value // for each point - std::cout << points << '\n' << predictions << '\n'; for(size_t i = 0; i < predictions.n_cols; ++i) - { - assert( fabs(predictions(i) - responses(i)) < .5); - } + BOOST_REQUIRE_CLOSE(predictions(i), responses(i), 35); } BOOST_AUTO_TEST_SUITE_END();