datasketch icon indicating copy to clipboard operation
datasketch copied to clipboard

Question: Why getting a min-hash for a single sample is possible?

Open bdeng3 opened this issue 2 years ago • 2 comments

Say if we have three documents A, B and C. Each document might contains different words.

According to the document of data sketch.MinHash, we can get a min-hash for A with

minxish = Minhash(num_perm=128) minhash.update(A.encode('utf-8')) vector = minhash.digest()

But isn't that we need to create a vocabulary consisting of all words from A, B and C before getting the vector?

bdeng3 avatar Apr 06 '22 08:04 bdeng3

I'm also interested in seeing this topic answered.

akuuzii avatar Apr 11 '22 13:04 akuuzii

Good question. The idea here is to "cheat" by mapping each token (or "word" in your example) to an integer in the hash space, which we know the complete vocabulary -- all integers 0 - 2^32!

ekzhu avatar Jun 02 '22 19:06 ekzhu