Each course title is a sparse vector x whose features f are its tokens.
Bit i of its signature is a random hyperplane test,
LSH[i] = sum(x[f]·r[i,f] for f in x) > 0 ? 1 : 0,
with r[i,f] ~ Normal(0,1). Two vectors at angle θ disagree on a bit with
probability θ/π, so similar titles get codes with small Hamming distance.
The vertical dividers split each n-bit code h into m substrings
h(1),…,h(m) for multi-index hashing.
Signatures, sorted by Hamming distance to q
course
LSH bits
Ham
cos
10bit differs from qnumber after h⁽ᶻ⁾ = Hamming(q⁽ᶻ⁾, h⁽ᶻ⁾), bold green if < r/m, gray otherwiseHamming(q⁽ᶻ⁾, h⁽ᶻ⁾) ≤ D, for the D picked in q's row under h⁽ᶻ⁾
Click a title to make it q · click a bit to see how it was computed ·
click the Ham or cos column to plot Hamming distance against cosine.
Multi-index hashing
Algorithm
LSH(x):
for i = 1 to outputBits:
LSH[i] = sum(x[f]*r[i,f] for f in x) > 0 ? 1 : 0
pooled: r[i,f] = pool[hash(i,f) % poolSize]MIH candidates for q, radius r:
split each code h into h(1),…,h(m)
return all h with Hamming(q(z), h(z)) < r/m
for some z