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

Method union

join/LSH/datasketch/minhash.py:270–290  ·  view source on GitHub ↗

Create a MinHash which is the union of the MinHash objects passed as arguments. Args: *mhs: The MinHash objects to be united. The argument list length is variable, but must be at least 2. Returns: datasketch.MinHash: A new union MinHash.

(cls, *mhs)

Source from the content-addressed store, hash-verified

268
269 @classmethod
270 def union(cls, *mhs):
271 '''Create a MinHash which is the union of the MinHash objects passed as arguments.
272
273 Args:
274 *mhs: The MinHash objects to be united. The argument list length is variable,
275 but must be at least 2.
276
277 Returns:
278 datasketch.MinHash: A new union MinHash.
279 '''
280 if len(mhs) < 2:
281 raise ValueError("Cannot union less than 2 MinHash")
282 num_perm = len(mhs[0])
283 seed = mhs[0].seed
284 if any((seed != m.seed or num_perm != len(m)) for m in mhs):
285 raise ValueError("The unioning MinHash must have the\
286 same seed and number of permutation functions")
287 hashvalues = np.minimum.reduce([m.hashvalues for m in mhs])
288 permutations = mhs[0].permutations
289 return cls(num_perm=num_perm, seed=seed, hashvalues=hashvalues,
290 permutations=permutations)
291
292 @classmethod
293 def bulk(cls, b, **minhash_kwargs):

Callers 15

jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45
jaccard_similarityFunction · 0.45

Calls

no outgoing calls

Tested by 2

jaccard_similarityFunction · 0.36
jaccard_similarityFunction · 0.36