[mlpack] 218/324: Ball tree tests for EMST.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:22:12 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit 70509e2202d4799d665dffe94aeef4b75185c77f
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Fri Jul 25 16:08:25 2014 +0000

    Ball tree tests for EMST.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16860 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/tests/emst_test.cpp | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/src/mlpack/tests/emst_test.cpp b/src/mlpack/tests/emst_test.cpp
index 06a0746..a6f3742 100644
--- a/src/mlpack/tests/emst_test.cpp
+++ b/src/mlpack/tests/emst_test.cpp
@@ -245,4 +245,37 @@ BOOST_AUTO_TEST_CASE(CoverTreeTest)
 
 }
 
+/**
+ * Test BinarySpaceTree with Ball Bound.
+ */
+BOOST_AUTO_TEST_CASE(BallTreeTest)
+{
+  arma::mat inputData;
+  if (!data::Load("test_data_3_1000.csv", inputData))
+    BOOST_FAIL("Cannot load test dataset test_data_3_1000.csv!");
+
+  typedef BinarySpaceTree<BallBound<>, DTBStat> TreeType;
+
+  // naive mode.
+  DualTreeBoruvka<> bst(inputData, true);
+  // Ball tree.
+  DualTreeBoruvka<EuclideanDistance,
+                  BinarySpaceTree<BallBound<>, DTBStat> > ballt(inputData);
+
+  arma::mat bstResults;
+  arma::mat ballResults;
+
+  // Run the algorithms.
+  bst.ComputeMST(bstResults);
+  ballt.ComputeMST(ballResults);
+
+  for (size_t i = 0; i < bstResults.n_cols; i++)
+  {
+    BOOST_REQUIRE_EQUAL(bstResults(0, i), ballResults(0, i));
+    BOOST_REQUIRE_EQUAL(bstResults(1, i), ballResults(1, i));
+    BOOST_REQUIRE_CLOSE(bstResults(2, i), ballResults(2, i), 1e-5);
+  }
+
+}
+
 BOOST_AUTO_TEST_SUITE_END();

-- 
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