[mlpack-git] master: Fixes two minor bugs causing major headaches (4adaf8f)
gitdub at mlpack.org
gitdub at mlpack.org
Thu Jun 30 15:11:33 EDT 2016
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/eaa7182ebed8cce3fd6191dc1f8170546ea297da...812048c7c6bee0b6c8d936677f23bbb5930c6cfc
>---------------------------------------------------------------
commit 4adaf8ff14c595d7be895ec6337312984312e49f
Author: Yannis Mentekidis <mentekid at gmail.com>
Date: Wed Jun 8 21:48:42 2016 +0300
Fixes two minor bugs causing major headaches
>---------------------------------------------------------------
4adaf8ff14c595d7be895ec6337312984312e49f
src/mlpack/methods/lsh/lsh_main.cpp | 4 ++--
src/mlpack/methods/lsh/lsh_search_impl.hpp | 7 +++----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/mlpack/methods/lsh/lsh_main.cpp b/src/mlpack/methods/lsh/lsh_main.cpp
index 400a349..b2681da 100644
--- a/src/mlpack/methods/lsh/lsh_main.cpp
+++ b/src/mlpack/methods/lsh/lsh_main.cpp
@@ -182,11 +182,11 @@ int main(int argc, char *argv[])
Log::Info << "Loaded query data from '" << queryFile << "' ("
<< queryData.n_rows << " x " << queryData.n_cols << ")." << endl;
}
- allkann.Search(queryData, k, neighbors, distances, numProbes);
+ allkann.Search(queryData, k, neighbors, distances, 0, numProbes);
}
else
{
- allkann.Search(k, neighbors, distances, numProbes);
+ allkann.Search(k, neighbors, distances, 0, numProbes);
}
}
diff --git a/src/mlpack/methods/lsh/lsh_search_impl.hpp b/src/mlpack/methods/lsh/lsh_search_impl.hpp
index e90a84d..7868c3c 100644
--- a/src/mlpack/methods/lsh/lsh_search_impl.hpp
+++ b/src/mlpack/methods/lsh/lsh_search_impl.hpp
@@ -597,7 +597,7 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
for (size_t i = 0; i < numTablesToSearch; i++)
queryCodesNotFloored.unsafe_col(i) = projections.slice(i).t() * queryPoint;
queryCodesNotFloored += offsets.cols(0, numTablesToSearch - 1);
- allProjInTables /= hashWidth;
+ allProjInTables = queryCodesNotFloored/hashWidth;
// Compute the hash value of each key of the query into a bucket of the
// 'secondHashTable' using the 'secondHashWeights'.
@@ -612,7 +612,7 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
arma::mat hashMat;
if (T > 0)
{
- hashMat.set_size(T, numTablesToSearch);
+ hashMat.zeros(T, numTablesToSearch);
for (size_t i = 0; i < numTablesToSearch; ++i)
{
@@ -625,6 +625,7 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
// map the probing bin to second hash table bins
hashMat.col(i) = additionalProbingBins.t() * secondHashWeights;
+
for (size_t p = 0; p < T; ++p)
hashMat(p, i) = (double) ((size_t) hashMat(p, i) % secondHashSize);
}
@@ -639,7 +640,6 @@ void LSHSearch<SortPolicy>::ReturnIndicesFromTable(
hashMat.row(0) = hashVec;
}
-
// Count number of points hashed in the same bucket as the query
size_t maxNumPoints = 0;
for (size_t i = 0; i < numTablesToSearch; ++i) //For all tables
@@ -703,7 +703,6 @@ 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;
More information about the mlpack-git
mailing list