Generating Random Hash Functions for LSH Minhash Algorithm

后端 未结 2 1671
夕颜
夕颜 2020-12-16 08:33

I\'m programming a minhashing algorithm in Java that requires me to generate an arbitrary number of random hash functions (240 hash functions in my case), and run any number

2条回答
  •  天命终不由人
    2020-12-16 08:41

    So the method that I described above was almost correct. The numbers a and b should be randomly generated. However, c needs to be a prime number that is slightly larger than the maximum possible value of x. Once those numbers have been chosen, finding hash value h using h = ((a*x)+b) % c is the standard, accepted way to generate hash functions.

    Also, a and b should be random numbers from the range 1 to c-1.

提交回复
热议问题