【发布时间】:2015-09-15 09:28:41
【问题描述】:
我发现 Location Sensitive Hash 支持 EuclideanHash CosineHash 以及根据 github 中的存储库的一些其他哈希:lsh families。反正CosineHash很容易理解:
double result = vector.dot(randomProjection);
return result > 0 ? 1 : 0;
但后来EuclideanHash很难理解:
double hashValue = (vector.dot(randomProjection)+offset)/Double.valueOf(w); // offset = rand.nextInt(w)
return (int) Math.round(hashValue);
【问题讨论】:
标签: hash euclidean-distance trigonometry