MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / _init_permutations

Method _init_permutations

join/LSH/datasketch/minhash.py:111–118  ·  view source on GitHub ↗
(self, num_perm)

Source from the content-addressed store, hash-verified

109 return np.ones(num_perm, dtype=np.uint64)*_max_hash
110
111 def _init_permutations(self, num_perm):
112 # Create parameters for a random bijective permutation function
113 # that maps a 32-bit hash value to another 32-bit hash value.
114 # http://en.wikipedia.org/wiki/Universal_hashing
115 gen = np.random.RandomState(self.seed)
116 return np.array([
117 (gen.randint(1, _mersenne_prime, dtype=np.uint64), gen.randint(0, _mersenne_prime, dtype=np.uint64)) for _ in range(num_perm)
118 ], dtype=np.uint64).T
119
120 def _parse_hashvalues(self, hashvalues):
121 return np.array(hashvalues, dtype=np.uint64)

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected