[mlpack-git] master: Fixes style issues in LSH Tests and LSH Class (f1e11fd)
gitdub at mlpack.org
gitdub at mlpack.org
Wed Jun 29 11:52:05 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/eaa7182ebed8cce3fd6191dc1f8170546ea297da...812048c7c6bee0b6c8d936677f23bbb5930c6cfc
>---------------------------------------------------------------
commit f1e11fd8dde123826be1d1b49945f2d91180e01b
Author: Yannis Mentekidis <mentekid at gmail.com>
Date: Wed Jun 29 16:52:05 2016 +0100
Fixes style issues in LSH Tests and LSH Class
>---------------------------------------------------------------
f1e11fd8dde123826be1d1b49945f2d91180e01b
src/mlpack/methods/lsh/lsh_search_impl.hpp | 6 ++----
src/mlpack/tests/lsh_test.cpp | 15 ++++++---------
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/mlpack/methods/lsh/lsh_search_impl.hpp b/src/mlpack/methods/lsh/lsh_search_impl.hpp
index 7ad96d0..ab81088 100644
--- a/src/mlpack/methods/lsh/lsh_search_impl.hpp
+++ b/src/mlpack/methods/lsh/lsh_search_impl.hpp
@@ -582,8 +582,7 @@ void LSHSearch<SortPolicy>::GetAdditionalProbingBins(
perturbationSets.push_back(As); // add shifted set to sets
minHeap.push(
std::make_pair(PerturbationScore(As, scores),
- perturbationSets.size() - 1)
- );
+ perturbationSets.size() - 1));
}
// Expand operation on Ai (add max+1 to set).
@@ -594,8 +593,7 @@ void LSHSearch<SortPolicy>::GetAdditionalProbingBins(
perturbationSets.push_back(Ae); // add expanded set to sets
minHeap.push(
std::make_pair(PerturbationScore(Ae, scores),
- perturbationSets.size() - 1)
- );
+ perturbationSets.size() - 1));
}
} while (!PerturbationValid(Ai));//Discard invalid perturbations
diff --git a/src/mlpack/tests/lsh_test.cpp b/src/mlpack/tests/lsh_test.cpp
index d35182e..bac6801 100644
--- a/src/mlpack/tests/lsh_test.cpp
+++ b/src/mlpack/tests/lsh_test.cpp
@@ -553,14 +553,12 @@ BOOST_AUTO_TEST_CASE(MultiprobeTest)
*/
BOOST_AUTO_TEST_CASE(MultiprobeDeterministicTest)
{
- math::RandomSeed(std::time(NULL));
-
// Generate known deterministic clusters of points.
const size_t N = 40;
arma::mat rdata;
GetPointset(N, rdata);
- const int k = N/4;
+ const int k = N / 4;
const double hashWidth = 1;
const int secondHashSize = 99901;
const int bucketSize = 500;
@@ -581,12 +579,12 @@ BOOST_AUTO_TEST_CASE(MultiprobeDeterministicTest)
// Construct q1 so it is hashed directly under C2.
arma::mat q1;
q1 << 3.9 << arma::endr << 2.99;
- q1-= offsets;
+ q1 -= offsets;
// Construct q2 so it is hashed near the center of C2.
arma::mat q2;
q2 << 3.6 << arma::endr << 3.6;
- q2-= offsets;
+ q2 -= offsets;
arma::Mat<size_t> neighbors;
arma::mat distances;
@@ -599,18 +597,18 @@ BOOST_AUTO_TEST_CASE(MultiprobeDeterministicTest)
lshTest.Search(q1, k, neighbors, distances, 0, 1);
BOOST_REQUIRE(arma::all(
neighbors.col(0) == N ||
- (neighbors.col(0) >= 10 && neighbors.col(0) < 20)));
+ (neighbors.col(0) >= N / 4 && neighbors.col(0) < N / 2)));
// Test that q2 simple search returns some C2 points.
lshTest.Search(q2, k, neighbors, distances);
BOOST_REQUIRE(arma::all(
neighbors.col(0) == N ||
- (neighbors.col(0) >= 10 && neighbors.col(0) < 20)));
+ (neighbors.col(0) >= N / 4 && neighbors.col(0) < N / 2)));
// Test that q2 with 3 additional probes returns all C2 points.
lshTest.Search(q2, k, neighbors, distances, 0, 3);
BOOST_REQUIRE(arma::all(
- neighbors.col(0) >= 10 && neighbors.col(0) < 20));
+ neighbors.col(0) >= N / 4 && neighbors.col(0) < N / 2));
}
@@ -730,7 +728,6 @@ BOOST_AUTO_TEST_CASE(RecallTestException)
BOOST_REQUIRE_THROW(LSHSearch<>::ComputeRecall(base, q4),
std::invalid_argument);
-
}
BOOST_AUTO_TEST_CASE(EmptyConstructorTest)
More information about the mlpack-git
mailing list