[mlpack-git] master: Finish Range test. (fa1153b)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Wed Dec 23 11:42:22 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/de9cc4b05069e1fa4793d9355f2f595af5ff45d2...6070527af14296cd99739de6c62666cc5d2a2125

>---------------------------------------------------------------

commit fa1153b1bb5127f72e84cbed1fc706bee29ef378
Author: ryan <ryan at ratml.org>
Date:   Tue Sep 22 16:05:07 2015 -0400

    Finish Range test.


>---------------------------------------------------------------

fa1153b1bb5127f72e84cbed1fc706bee29ef378
 src/mlpack/tests/hoeffding_tree_test.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mlpack/tests/hoeffding_tree_test.cpp b/src/mlpack/tests/hoeffding_tree_test.cpp
index 35952de..7c3e6ab 100644
--- a/src/mlpack/tests/hoeffding_tree_test.cpp
+++ b/src/mlpack/tests/hoeffding_tree_test.cpp
@@ -113,7 +113,14 @@ BOOST_AUTO_TEST_CASE(GiniImpurityZeroTest)
  */
 BOOST_AUTO_TEST_CASE(GiniImpurityRangeTest)
 {
-  BOOST_REQUIRE_CLOSE(GiniImpurity::Range(0), 1, 1e-5);
+  BOOST_REQUIRE_CLOSE(GiniImpurity::Range(1), 0, 1e-5);
+  BOOST_REQUIRE_CLOSE(GiniImpurity::Range(2), 0.5, 1e-5);
+  BOOST_REQUIRE_CLOSE(GiniImpurity::Range(3), 0.66666667, 1e-5);
+  BOOST_REQUIRE_CLOSE(GiniImpurity::Range(4), 0.75, 1e-5);
+  BOOST_REQUIRE_CLOSE(GiniImpurity::Range(5), 0.8, 1e-5);
+  BOOST_REQUIRE_CLOSE(GiniImpurity::Range(10), 0.9, 1e-5);
+  BOOST_REQUIRE_CLOSE(GiniImpurity::Range(100), 0.99, 1e-5);
+  BOOST_REQUIRE_CLOSE(GiniImpurity::Range(1000), 0.999, 1e-5);
 }
 
 /**



More information about the mlpack-git mailing list