Quiz 2
Registry Synced

MinHash, SimHash, and Bloom Filters

136 words
1 min read

Reading compass

Now · 6.1 MinHash

MinHash, SimHash, and Bloom Filters

6.1 MinHash

Estimates Jaccard similarity J(A,B)=AB/ABJ(A,B) = |A \cap B| / |A \cup B|:
Pr[hmin(A)=hmin(B)]=J(A,B)\Pr[h_{\min}(A) = h_{\min}(B)] = J(A,B)
python
import numpy as np
def minhash_signature(set_of_ints, num_hashes=100):
    max_int = 2**32 - 1
    seeds = np.random.randint(0, max_int, num_hashes)
    sig = np.full(num_hashes, np.inf)
    for val in set_of_ints:
        for i, seed in enumerate(seeds):
            h = (seed * val + seed) % max_int
            sig[i] = min(sig[i], h)
    return sig

6.2 Bloom Filter

Space-efficient probabilistic membership test:
  • No false negatives (if "no", definitely not in set)
  • False positives possible (if "yes", might not be in set) Operations: add(x), query(x) — both O(k)O(k) where kk is number of hash functions. False positive rate: (1ekn/m)k(1 - e^{-kn/m})^k where mm is bits and nn is elements. Join Discord PreviousLocality-Sensitive HashingNextRandomized Regression
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.