Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
bdeng3 opened this issue Apr 6, 2022 · 2 comments
Open

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

bdeng3 opened this issue Apr 6, 2022 · 2 comments
Labels

Comments

@bdeng3
Copy link

bdeng3 commented Apr 6, 2022

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?

@akuuzii
Copy link

akuuzii commented Apr 11, 2022

I'm also interested in seeing this topic answered.

@ekzhu
Copy link
Owner

ekzhu commented Jun 2, 2022

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 ekzhu added the question label Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants