All Projects → LiveRamp → HyperMinHash-java

LiveRamp / HyperMinHash-java

Licence: other
Union, intersection, and set cardinality in loglog space

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to HyperMinHash-java

set-sketch-paper
SetSketch: Filling the Gap between MinHash and HyperLogLog
Stars: ✭ 23 (-52.08%)
Mutual labels:  minhash, hyperloglog, cardinality-estimation, hyperloglog-sketches
HyperLogLog
Fast HyperLogLog for Python.
Stars: ✭ 86 (+79.17%)
Mutual labels:  hyperloglog, cardinality-estimation, cardinality
hyperloglog-sketch-estimation-paper
Paper about the estimation of cardinalities from HyperLogLog sketches
Stars: ✭ 48 (+0%)
Mutual labels:  hyperloglog, cardinality-estimation, hyperloglog-sketches
Datasketch
MinHash, LSH, LSH Forest, Weighted MinHash, HyperLogLog, HyperLogLog++, LSH Ensemble
Stars: ✭ 1,635 (+3306.25%)
Mutual labels:  minhash, hyperloglog
ntCard
Estimating k-mer coverage histogram of genomics data
Stars: ✭ 69 (+43.75%)
Mutual labels:  hyperloglog, cardinality-estimation
rust-hyperloglog
A HyperLogLog implementation in Rust.
Stars: ✭ 44 (-8.33%)
Mutual labels:  hyperloglog
intertext
Detect and visualize text reuse
Stars: ✭ 97 (+102.08%)
Mutual labels:  minhash
Neural-Scam-Artist
Web Scraping, Document Deduplication & GPT-2 Fine-tuning with a newly created scam dataset.
Stars: ✭ 18 (-62.5%)
Mutual labels:  minhash
deepdb-public
Implementation of DeepDB: Learn from Data, not from Queries!
Stars: ✭ 61 (+27.08%)
Mutual labels:  cardinality-estimation
naru
Neural Relation Understanding: neural cardinality estimators for tabular data
Stars: ✭ 76 (+58.33%)
Mutual labels:  cardinality-estimation
sketches
HyperLogLog and other probabilistic data structures for mining in data streams
Stars: ✭ 15 (-68.75%)
Mutual labels:  hyperloglog
bagminhash
BagMinHash - Minwise Hashing Algorithm for Weighted Sets
Stars: ✭ 24 (-50%)
Mutual labels:  minhash
catch-me-if-you-can
plagiarism detector
Stars: ✭ 16 (-66.67%)
Mutual labels:  minhash
minhash-lsh
Minhash LSH in Golang
Stars: ✭ 20 (-58.33%)
Mutual labels:  minhash
text-shingles
k-shingling for text to help compare similarity
Stars: ✭ 15 (-68.75%)
Mutual labels:  minhash
rkmh
Classify sequencing reads using MinHash.
Stars: ✭ 42 (-12.5%)
Mutual labels:  minhash
Sampled-MinHashing
A method to mine beyond-pairwise relationships using Min-Hashing for large-scale pattern discovery
Stars: ✭ 24 (-50%)
Mutual labels:  minhash
mkmh
Generate kmers/minimizers/hashes/MinHash signatures, including with multiple kmer sizes.
Stars: ✭ 21 (-56.25%)
Mutual labels:  minhash
phphll
HyperLogLog for PHP implemented as a C extension
Stars: ✭ 19 (-60.42%)
Mutual labels:  hyperloglog

Build Status

HyperMinHash-java

A Java implementation of the HyperMinHash algorithm, presented by Yu and Weber. HyperMinHash allows approximating set unions, intersections, Jaccard Indices, and cardinalities of very large sets with high accuracy using only loglog space. It also supports streaming updates and merging sketches, just the same as HyperLogLog.

This repo implements two flavors of HyperMinHash:

  1. HyperMinHash: An implementation based on HyperLogLog with the addition of the bias correction seen in HyperLogLog++.
  2. BetaMinHash: An implementation which uses LogLog-Beta for the underlying LogLog implementation. Loglog-beta is almost identical in accuracy to HyperLogLog++, except it performs better on cardinality estimations for small datasets (n <= 80k), holding memory fixed. Since we use Loglog-Beta, we refer to our implementation as BetaMinHash. However, our implementation currently only supports a fixed precision p=14.

If you expect to be dealing with low cardinality datasets (<= 80,000 unique elements), we recommend using BetaMinHash as it has a smaller memory footprint and is more accurate than HyperLogLog in the range from 20,000-80,000, holding memory fixed. However, note that different sketch types are not interchangeable i.e: obtaining the intersection of an HMH and a BMH is not currently supported.

Both implementations are equipped with serialization/deserialization capabilities out of the box for sending sketches over the wire or persisting them to disk.

Usage

Importing via Maven

<dependency>
  <groupId>com.liveramp</groupId>
  <artifactId>hyperminhash</artifactId>
  <version>0.2</version>
</dependency>

Cardinality estimation

Set<byte[]> mySet = getMySet();
BetaMinHash sketch = new BetaMinHash();
for (byte[] element : mySet){
    sketch.add(element);
}

long estimatedCardinality = sketch.cardinality();

Merging (unioning) sketches

Collection<BetaMinHash> sketches = getSketches();
SketchCombiner<BetaMinHash> combiner = BetaMinHashCombiner.getInstance();
BetaMinHash combined = combiner.union(sketches);

// to get cardinality of the union
long unionCardinality = combined.cardinality();

// using HyperMinHash instead of BetaMinHash
Collection<HyperMinHash> sketches = getSketches();
SketchCombiner<HyperMinHash> combiner = HyperMinHashCombinre.getInstance();
HyperMinHash combined = combiner.union(sketches);

Cardinality of unions

BetaMinHash combined = combiner.union(sketches);
long estimatedCardinality = combined.cardinality();

Cardinality of intersection

Collection<BetaMinHash> sketches = getSketches();
SketchCombiner<BetaMinHash> combiner = BetaMinHashComber.getInstance();
long intersectionCardinality = combiner.intersectionCardinality(sketches);

Serializing a sketch

To get a byte[] representation of a sketch, use the IntersectionSketch.SerDe interface:

HyperMinHash sketch = getSketch();
HyperMinHashSerde serde = new HyperMinHashSerde();

byte[] serialized = serde.toBytes(sketch);
HyperMinHash deserialized = serde.fromBytes(serialized);

int sizeInBytes = serde.sizeInBytes(sketch);

Maintainers

Commit authorship was lost when merging code. The maintainers of the library, in alphabetical order, are:

  1. Christian Hansen (github.com/ChristianHansen)
  2. Harry Rackmil (github.com/harryrackmil)
  3. Shrif Nada (github.com/sherifnada)

Acknowledgements

Thanks to Seif Lotfy for implementing a Golang version of HyperMinHash. We use some of his tests in our library, and our BetaMinHash implementation references his implementation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].