Algorithm Search⌘K

Proofs: E2LSH

These are the human proofs of E2LSH, at full length.

E2LSH answers the (c, r)-near neighbor query with constant probability full

This proof shows: correctness.

Let P⊆RdP \subseteq \mathbb{R}^d with ∣P∣=n≥1|P| = n \ge 1, r>0r > 0, c>1c > 1 and w>0w > 0. A function of the family is h(v)=⌊(a⋅v+b)/w⌋h(v) = \lfloor (a \cdot v + b)/w \rfloor with aa a vector of dd independent N(0,1)N(0,1) entries and bb uniform in [0,w)[0, w), independent of aa.

Lemma 1. For ∥x−y∥=u>0\|x - y\| = u > 0, Pr⁡[h(x)=h(y)]=p(u):=E[max⁡(0,1−u∣Z∣/w)]\Pr[h(x) = h(y)] = p(u) := \mathbb{E}\big[\max(0, 1 - u|Z|/w)\big] with Z∼N(0,1)Z \sim N(0,1).

Proof. The random variable a⋅(x−y)=∑iai(xi−yi)a \cdot (x - y) = \sum_i a_i (x_i - y_i) is a sum of independent normal variables, so it is normal with mean 0 and variance ∑i(xi−yi)2=u2\sum_i (x_i - y_i)^2 = u^2; it has the law of uZuZ. Fix aa and let α=a⋅x\alpha = a \cdot x, β=a⋅y\beta = a \cdot y, s=∣α−β∣s = |\alpha - \beta|. Then h(x)=h(y)h(x) = h(y) if and only if the half-open interval between α+b\alpha + b and β+b\beta + b (of length ss) contains no multiple of ww. Since bb is uniform on [0,w)[0, w), the set {α+b}\{\alpha + b\} modulo ww is uniform on [0,w)[0, w). If s≥ws \ge w, the interval always contains a multiple of ww. If s<ws < w, it contains one exactly when (min⁡(α,β)+b) mod w(\min(\alpha, \beta) + b) \bmod w lies in a set of length ss, which has probability s/ws/w. So Pr⁡[h(x)=h(y)∣a]=max⁡(0,1−s/w)\Pr[h(x) = h(y) \mid a] = \max(0, 1 - s/w), and taking the expectation over aa gives the lemma. □\square

Lemma 2. pp is strictly decreasing on (0,∞)(0, \infty), and with t=w/ut = w/u,

p(u)=1−2Φ(−t)−22π t(1−e−t2/2).p(u) = 1 - 2\Phi(-t) - \frac{2}{\sqrt{2\pi}\,t}\big(1 - e^{-t^2/2}\big).

Proof. For each value of ZZ, max⁡(0,1−u∣Z∣/w)\max(0, 1 - u|Z|/w) is nonincreasing in uu, and strictly decreasing when ∣Z∣<w/u|Z| < w/u, an event of positive probability. So the expectation is strictly decreasing. For the closed form, ∣Z∣|Z| has density 2φ(z)2\varphi(z) on z≥0z \ge 0, with φ(z)=e−z2/2/2π\varphi(z) = e^{-z^2/2}/\sqrt{2\pi}, and the integrand is 0 for z≥tz \ge t. So

p(u)=∫0t2φ(z)(1−zt)dz=(2Φ(t)−1)−2t∫0tzφ(z) dz=1−2Φ(−t)−2t(φ(0)−φ(t)),p(u) = \int_0^t 2\varphi(z)\Big(1 - \frac{z}{t}\Big) dz = \big(2\Phi(t) - 1\big) - \frac{2}{t}\int_0^t z\varphi(z)\,dz = 1 - 2\Phi(-t) - \frac{2}{t}\big(\varphi(0) - \varphi(t)\big),

using ∫0tzφ(z)dz=φ(0)−φ(t)\int_0^t z\varphi(z)dz = \varphi(0) - \varphi(t) and 2Φ(t)−1=1−2Φ(−t)2\Phi(t) - 1 = 1 - 2\Phi(-t). □\square

So the family is (r,cr,p1,p2)(r, cr, p_1, p_2)-sensitive with p1=p(r)>p2=p(cr)p_1 = p(r) > p_2 = p(cr): points within rr collide with probability at least p(r)p(r), and points beyond crcr with probability less than p(cr)p(cr).

Theorem. Let ρ=ln⁡(1/p1)/ln⁡(1/p2)\rho = \ln(1/p_1)/\ln(1/p_2), k=⌈ln⁡n/ln⁡(1/p2)⌉k = \lceil \ln n/\ln(1/p_2) \rceil and L=⌈nρ/p1⌉L = \lceil n^\rho / p_1 \rceil, and fix qq with some p∗∈Pp^* \in P, ∥q−p∗∥≤r\|q - p^*\| \le r. Then E2LSH-QUERY(q,c,r)(q, c, r) returns a point within crcr with probability at least 2/3−1/e2/3 - 1/e, and it never returns a point beyond crcr.

Proof. Only line L6 returns a point, after the test ∥q−x∥≤cr\|q - x\| \le cr, so no far point is returned. The kLkL functions are independent, so for one table Pr⁡[gj(p∗)=gj(q)]≥p1k\Pr[g_j(p^*) = g_j(q)] \ge p_1^k and Pr⁡[gj(x)=gj(q)]≤p2k≤1/n\Pr[g_j(x) = g_j(q)] \le p_2^k \le 1/n for each xx with ∥q−x∥>cr\|q - x\| > cr.

Event E1E_1: p∗p^* collides with qq in some table. Since k<ln⁡n/ln⁡(1/p2)+1k < \ln n/\ln(1/p_2) + 1, p1k≥p1⋅e−ln⁡n⋅ln⁡(1/p1)/ln⁡(1/p2)=p1n−ρp_1^k \ge p_1 \cdot e^{-\ln n \cdot \ln(1/p_1)/\ln(1/p_2)} = p_1 n^{-\rho}, so Lp1k≥1L p_1^k \ge 1 and Pr⁡[not E1]≤(1−p1k)L≤e−Lp1k≤1/e\Pr[\text{not } E_1] \le (1 - p_1^k)^L \le e^{-L p_1^k} \le 1/e.

Event E2E_2: fewer than 3L3L pairs (j,x)(j, x) with xx beyond crcr and gj(x)=gj(q)g_j(x) = g_j(q). Their expected number is at most L⋅n⋅(1/n)=LL \cdot n \cdot (1/n) = L, so by Markov's inequality Pr⁡[not E2]≤1/3\Pr[\text{not } E_2] \le 1/3.

Both events give an answer. If the query returned none, every counted pair failed line L6, so every counted pair is far, and the count stays below 3L3L by E2E_2. Then line L7 never fires, the loop visits all buckets of qq, and by E1E_1 it meets p∗p^*, which passes line L6, a contradiction.

By the union bound, Pr⁡[E1∩E2]≥1−1/e−1/3=2/3−1/e\Pr[E_1 \cap E_2] \ge 1 - 1/e - 1/3 = 2/3 - 1/e. ■\blacksquare

Back to E2LSH