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

Method bulk

join/LSH/datasketch/minhash.py:293–317  ·  view source on GitHub ↗

Compute MinHashes in bulk. This method avoids unnecessary overhead when initializing many minhashes by reusing the initialized state. Args: b (Iterable): An Iterable of lists of bytes, each list is hashed in to one MinHash in the output.

(cls, b, **minhash_kwargs)

Source from the content-addressed store, hash-verified

291
292 @classmethod
293 def bulk(cls, b, **minhash_kwargs):
294 '''Compute MinHashes in bulk. This method avoids unnecessary
295 overhead when initializing many minhashes by reusing the initialized
296 state.
297
298 Args:
299 b (Iterable): An Iterable of lists of bytes, each list is
300 hashed in to one MinHash in the output.
301 minhash_kwargs: Keyword arguments used to initialize MinHash,
302 will be used for all minhashes.
303
304 Returns:
305 List[datasketch.MinHash]: A list of computed MinHashes.
306
307 Example:
308
309 .. code-block:: python
310
311 from datasketch import MinHash
312 data = [[b'token1', b'token2', b'token3'],
313 [b'token4', b'token5', b'token6']]
314 minhashes = MinHash.bulk(data, num_perm=64)
315
316 '''
317 return list(cls.generator(b, **minhash_kwargs))
318
319 @classmethod
320 def generator(cls, b, **minhash_kwargs):

Callers

nothing calls this directly

Calls 1

generatorMethod · 0.45

Tested by

no test coverage detected