Registry Synced

Johnson-Lindenstrauss Lemma

138 words
1 min read

Reading compass

Now · 4.1 Statement

Johnson-Lindenstrauss Lemma

4.1 Statement

For any ϵ∈(0,1/2)\epsilon \in (0, 1/2) and any set of nn points in Rd\mathbb{R}^d, there exists a map f:Rd→Rmf: \mathbb{R}^d \to \mathbb{R}^m with m=O(log⁡n/ϵ2)m = O(\log n / \epsilon^2) such that for all u,vu, v:
(1−ϵ)∣∣u−v∣∣2≤∣∣f(u)−f(v)∣∣2≤(1+ϵ)∣∣u−v∣∣2(1-\epsilon)||u-v||^2 \leq ||f(u)-f(v)||^2 \leq (1+\epsilon)||u-v||^2

4.2 Random Projection

python
import numpy as np
def random_projection(X, epsilon=0.1):
    n, d = X.shape
    m = int(4 * np.log(n) / (epsilon**2 / 2 - epsilon**3 / 3))
    R = np.random.randn(d, m) / np.sqrt(m)
    return X @ R
# Example
X = np.random.randn(1000, 10000)
X_proj = random_projection(X, epsilon=0.1)
print(f"Reduced from {X.shape[1]} to {X_proj.shape[1]} dimensions")

4.3 Key Insight

The target dimension mm depends only on nn (number of points), not on dd (original dimension). This makes JL extremely powerful for high-dimensional data. Join Discord PreviousSpectral Graph TheoryNextJL Proof
Document outline

Keep your place and jump directly to a heading.

Table of contents

No note selected

Open a chapter to see its outline, backlinks, and sources here.