[mlpack-git] master: Refactor tests to deal with modified NeighborSearch. (9690b45)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Fri Jul 10 19:00:14 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/4a97187bbba7ce8a6191b714949dd818ef0f37d2...e5905e62c15d1bcff21e6359b11efcd7ab6d7ca0
>---------------------------------------------------------------
commit 9690b4528605b4a708668bf984c9916e2c9b5aab
Author: ryan <ryan at ratml.org>
Date: Wed Apr 22 18:13:16 2015 -0400
Refactor tests to deal with modified NeighborSearch.
>---------------------------------------------------------------
9690b4528605b4a708668bf984c9916e2c9b5aab
src/mlpack/tests/allkfn_test.cpp | 7 +++----
src/mlpack/tests/allknn_test.cpp | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/src/mlpack/tests/allkfn_test.cpp b/src/mlpack/tests/allkfn_test.cpp
index ea7039a..96c1d12 100644
--- a/src/mlpack/tests/allkfn_test.cpp
+++ b/src/mlpack/tests/allkfn_test.cpp
@@ -46,10 +46,9 @@ BOOST_AUTO_TEST_CASE(ExhaustiveSyntheticTest)
// We will loop through three times, one for each method of performing the
// calculation. We'll always use 10 neighbors, so set that parameter.
- arma::mat dataMutable = data;
std::vector<size_t> oldFromNew;
std::vector<size_t> newFromOld;
- TreeType* tree = new TreeType(dataMutable, oldFromNew, newFromOld, 1);
+ TreeType* tree = new TreeType(data, oldFromNew, newFromOld, 1);
for (int i = 0; i < 3; i++)
{
AllkFN* allkfn;
@@ -63,7 +62,7 @@ BOOST_AUTO_TEST_CASE(ExhaustiveSyntheticTest)
allkfn = new AllkFN(tree, true);
break;
case 2: // Use the naive method.
- allkfn = new AllkFN(dataMutable, true);
+ allkfn = new AllkFN(tree->Dataset(), true);
break;
}
@@ -521,7 +520,7 @@ BOOST_AUTO_TEST_CASE(SingleBallTreeTest)
NeighborSearch<FurthestNeighborSort, LMetric<2>, TreeType>
ballTreeSearch(&tree, true);
- AllkFN naive(data, true);
+ AllkFN naive(tree.Dataset(), true);
arma::Mat<size_t> ballTreeNeighbors;
arma::mat ballTreeDistances;
diff --git a/src/mlpack/tests/allknn_test.cpp b/src/mlpack/tests/allknn_test.cpp
index 91a8aca..37dd1c8 100644
--- a/src/mlpack/tests/allknn_test.cpp
+++ b/src/mlpack/tests/allknn_test.cpp
@@ -189,10 +189,9 @@ BOOST_AUTO_TEST_CASE(ExhaustiveSyntheticTest)
// We will loop through three times, one for each method of performing the
// calculation.
- arma::mat dataMutable = data;
std::vector<size_t> oldFromNew;
std::vector<size_t> newFromOld;
- TreeType* tree = new TreeType(dataMutable, oldFromNew, newFromOld, 1);
+ TreeType* tree = new TreeType(data, oldFromNew, newFromOld, 1);
for (int i = 0; i < 3; i++)
{
AllkNN* allknn;
@@ -206,7 +205,7 @@ BOOST_AUTO_TEST_CASE(ExhaustiveSyntheticTest)
allknn = new AllkNN(tree, true);
break;
case 2: // Use the naive method.
- allknn = new AllkNN(dataMutable, true);
+ allknn = new AllkNN(tree->Dataset(), true);
break;
}
@@ -667,7 +666,7 @@ BOOST_AUTO_TEST_CASE(SingleBallTreeTest)
NeighborSearch<NearestNeighborSort, LMetric<2>, TreeType>
ballTreeSearch(&tree, true);
- AllkNN naive(data, true);
+ AllkNN naive(tree.Dataset(), true);
arma::Mat<size_t> ballTreeNeighbors;
arma::mat ballTreeDistances;
More information about the mlpack-git
mailing list