[mlpack-git] master: There is a bug in ReturnIndicesFromTable (27510fe)

gitdub at mlpack.org gitdub at mlpack.org
Thu Jun 30 15:11:29 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/eaa7182ebed8cce3fd6191dc1f8170546ea297da...812048c7c6bee0b6c8d936677f23bbb5930c6cfc

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

commit 27510fe5cded3d67b5e832d41656db1f8dca92e8
Author: Yannis Mentekidis <mentekid at gmail.com>
Date:   Wed Jun 8 21:20:02 2016 +0300

    There is a bug in ReturnIndicesFromTable


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

27510fe5cded3d67b5e832d41656db1f8dca92e8
 src/mlpack/methods/lsh/lsh_search_impl.hpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/methods/lsh/lsh_search_impl.hpp b/src/mlpack/methods/lsh/lsh_search_impl.hpp
index a901de8..f5c9781 100644
--- a/src/mlpack/methods/lsh/lsh_search_impl.hpp
+++ b/src/mlpack/methods/lsh/lsh_search_impl.hpp
@@ -639,6 +639,7 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
     hashMat.row(0) = hashVec;
   }
 
+  std::cout<<hashMat<<std::endl;
 
   // Count number of points hashed in the same bucket as the query
   size_t maxNumPoints = 0;
@@ -693,6 +694,7 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
     }
 
     // Only keep reference points found in at least one bucket.
+    std::cout<<"find"<<std::endl;
     referenceIndices = arma::find(refPointsConsidered > 0);
     return;
   }
@@ -703,6 +705,7 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
     // Allocate space for the query's potential neighbors.
     arma::uvec refPointsConsideredSmall;
     refPointsConsideredSmall.zeros(maxNumPoints);
+    std::cout<<"unique"<<std::endl;
 
     // Retrieve candidates.
     size_t start = 0;
@@ -710,7 +713,7 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
     {
       for (size_t p = 0; p < T + 1; ++p)
       {
-        size_t hashInd = (size_t) hashVec[i]; // Find the query's bucket.
+        size_t hashInd = (size_t) hashMat(p, i); // Find the query's bucket.
 
         if (bucketContentSize[hashInd] > 0)
         {
@@ -719,7 +722,6 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
           assert(tableRow < secondHashSize);
           assert(tableRow < secondHashTable.n_rows);
 
-          // This for-loop could be replaced with a vector slice (TODO).
           // Store all secondHashTable points in the candidates set.
           for (size_t j = 0; j < bucketContentSize[hashInd]; ++j)
             refPointsConsideredSmall(start++) = secondHashTable(tableRow, j);




More information about the mlpack-git mailing list