I recently came to see that this library sparselsh uses random projection to perform locally sensitive hashing of documents.

The proof is such that based on cosine similarity to the vector. In other words if the dot product of a random projection vector and a feature vector > 0, it would mean that the angle is obtuse and <0 if the angle is acute. However, i cannot seem to understand it.

Assuming v is a feature vector containing a bag of words, and the random projection vector being drawn from a normal distribution. I can safely say that v will never have negative elements since the bag of words vector can never have a negative value. In this case, How would there be a situation when r.v give an obtuse angle? Am i misunderstanding something?

I have referred to this question but to no avail. Locality-sensitive hashing random projection

Let me state my confusion clearer.

enter image description here

Consider a 2 dimensional vector space, Given that r.v < 0 if the angle between the two vectors are less than 90degrees and >0 when they are above 90 degrees. This would mean that the probability of the blue vector dot product with another data point giving a r.v > 0 is zero. This would mean that i can only draw vectors in the negative space?

  • $\begingroup$ "The proof" -- what proof? "I cannot seem to understand it" -- what specifically don't you understand? $\endgroup$ – D.W. May 8 '17 at 22:59

$r \cdot v$ can be negative even if all elements of $v$ are positive: consider, e.g., $r = (2,-3)$ and $v=(1,1)$. Then $r \cdot v = -1$.

Also, using random projections is not the same as defining a hash to be 1 if the dot-product is $\ge 0$ and 0 if it is $<0$. You can still use a random projection without using that particular hash function. I haven't looked at the sparselsh code, but it's also possible that it could be using a random projection but without using that specific hash function.

| cite | improve this answer | |
  • $\begingroup$ i have edited my question to clarify my confusion better $\endgroup$ – aceminer May 9 '17 at 0:48
  • $\begingroup$ @aceminer, I've edited my answer. $\endgroup$ – D.W. May 9 '17 at 5:58
  • $\begingroup$ could you shed more light on the particular hash function. Sorry i didnt get that line well $\endgroup$ – aceminer May 9 '17 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.