[mlpack-git] master: Fixes bug caused merge. Changes code in lsh_test.cpp that caused test to fail (2af985c)
gitdub at mlpack.org
gitdub at mlpack.org
Thu Jun 23 06:12:07 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/eaa7182ebed8cce3fd6191dc1f8170546ea297da...812048c7c6bee0b6c8d936677f23bbb5930c6cfc
>---------------------------------------------------------------
commit 2af985cbe186de3017778994e16ea8f01d879578
Author: Yannis Mentekidis <mentekid at gmail.com>
Date: Thu Jun 23 11:12:07 2016 +0100
Fixes bug caused merge. Changes code in lsh_test.cpp that caused test to fail
>---------------------------------------------------------------
2af985cbe186de3017778994e16ea8f01d879578
src/mlpack/methods/lsh/lsh_search_impl.hpp | 17 +++++++----------
src/mlpack/tests/lsh_test.cpp | 4 ++--
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/mlpack/methods/lsh/lsh_search_impl.hpp b/src/mlpack/methods/lsh/lsh_search_impl.hpp
index 2f81b66..b1cc112 100644
--- a/src/mlpack/methods/lsh/lsh_search_impl.hpp
+++ b/src/mlpack/methods/lsh/lsh_search_impl.hpp
@@ -677,8 +677,8 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
{
const size_t hashInd = hashMat(p, i); // find query's bucket
const size_t tableRow = bucketRowInHashTable[hashInd];
- if (tableRow != secondHashSize)
- maxNumPoints += bucketContentSize[hashInd]; // count bucket contents
+ if (tableRow < secondHashSize)
+ maxNumPoints += bucketContentSize[tableRow]; // count bucket contents
}
}
@@ -708,16 +708,13 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
// get the sequence code
size_t hashInd = hashMat(p, i);
+ size_t tableRow = bucketRowInHashTable[hashInd];
- if (bucketContentSize[hashInd] > 0)
+ if (tableRow < secondHashSize && bucketContentSize[tableRow] > 0)
{
// Pick the indices in the bucket corresponding to hashInd.
- size_t tableRow = bucketRowInHashTable[hashInd];
- if (tableRow != secondHashSize)
- {
- for (size_t j = 0; j < bucketContentSize[tableRow]; ++j)
- refPointsConsidered[ secondHashTable[tableRow](j) ]++;
- }
+ for (size_t j = 0; j < bucketContentSize[tableRow]; ++j)
+ refPointsConsidered[ secondHashTable[tableRow](j) ]++;
}
}
}
@@ -743,7 +740,7 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
const size_t hashInd = hashMat(p, i); // Find the query's bucket.
const size_t tableRow = bucketRowInHashTable[hashInd];
- if (tableRow != secondHashSize)
+ if (tableRow < secondHashSize)
// Store all secondHashTable points in the candidates set.
for (size_t j = 0; j < bucketContentSize[tableRow]; ++j)
refPointsConsideredSmall(start++) = secondHashTable[tableRow][j];
diff --git a/src/mlpack/tests/lsh_test.cpp b/src/mlpack/tests/lsh_test.cpp
index 7ae48d1..d576387 100644
--- a/src/mlpack/tests/lsh_test.cpp
+++ b/src/mlpack/tests/lsh_test.cpp
@@ -332,7 +332,7 @@ BOOST_AUTO_TEST_CASE(RecallTest)
// Cheap LSH run.
const int hChp = 1; // Small first-level hash width.
- const int kChp = 1000; // Large number of projections per table.
+ const int kChp = 100; // Large number of projections per table.
const int tChp = 1; // Only one table.
const double recallThreshChp = 0.25; // Recall threshold.
@@ -531,7 +531,7 @@ BOOST_AUTO_TEST_CASE(MultiprobeTest)
numProbes[p]);
// compute recall
- double recall = ComputeRecall(lshNeighbors, groundTruth); //TODO: change to LSHSearch::ComputeRecall??
+ double recall = LSHSearch<>::ComputeRecall(lshNeighbors, groundTruth); //TODO: change to LSHSearch::ComputeRecall??
if (p > 0)
{
// more probes should at the very least not lower recall...
More information about the mlpack-git
mailing list