Johnson–Lindenstrauss lemma

In mathematics, the Johnson–Lindenstrauss lemma is a result named after William B. Johnson and Joram Lindenstrauss concerning low-distortion embeddings of points from high-dimensional into low-dimensional Euclidean space. The lemma states that a set of points in a high-dimensional space can be embedded into a space of much lower dimension in such a way that distances between the points are nearly preserved. In the classical proof of the lemma, the embedding is a random orthogonal projection.

The lemma has applications in compressed sensing, manifold learning, dimensionality reduction, and graph embedding. Much of the data stored and manipulated on computers, including text and images, can be represented as points in a high-dimensional space (see vector space model for the case of text). However, the essential algorithms for working with such data tend to become bogged down very quickly as dimension increases. It is therefore desirable to reduce the dimensionality of the data in a way that preserves its relevant structure. The Johnson–Lindenstrauss lemma is a classic result in this vein.

Also, the lemma is tight up to a constant factor, i.e. there exists a set of points of size m that needs dimension


 * $$ \Omega \left(\frac{\log(m)}{\varepsilon^2}\right)$$

in order to preserve the distances between all pairs of points within a factor of $$(1 \pm \varepsilon)$$.

Lemma
Given $$0 < \varepsilon < 1$$, a set $$X$$ of $$m$$ points in $$\mathbb{R}^N$$, and an integer $$n > 8(\ln m)/\varepsilon^2$$, there is a linear map $$f: \mathbb{R}^N \rightarrow \mathbb{R}^n$$ such that


 * $$(1-\varepsilon)\|u-v\|^2 \leq \|f(u) - f(v)\|^2 \leq (1+\varepsilon)\|u-v\|^2$$

for all $$u,v \in X$$.

The formula can be rearranged:$$(1+\varepsilon)^{-1}\|f(u)-f(v)\|^2 \leq \|u-v\|^2 \leq (1-\varepsilon)^{-1}\|f(u)-f(v)\|^2 $$

Alternatively, for any $$\epsilon\in(0,1)$$ and any integer $$n\ge15(\ln m)/\varepsilon^2$$ there exists a linear function $$f: \mathbb{R}^N \rightarrow \mathbb{R}^n$$ such that the restriction $$f|_X$$ is $$(1+\varepsilon)$$-bi-Lipschitz.

The classical proof of the lemma takes ƒ to be a scalar multiple of an orthogonal projection $$P$$ onto a random subspace of dimension $$n$$ in $$\mathbb{R}^N$$. An orthogonal projection collapses some dimensions of the space it is applied to, which reduces the length of all vectors, as well as distance between vectors in the space. Under the conditions of the lemma, concentration of measure ensures there is a nonzero chance that a random orthogonal projection reduces pairwise distances between all points in $$X$$ by roughly a constant factor $$c$$. Since the chance is nonzero, such projections must exist, so we can choose one $$P$$ and set $$f(v) = Pv/c$$.

To obtain the projection algorithmically, it suffices with high probability to repeatedly sample orthogonal projection matrices at random. If you keep rolling the dice, you will eventually obtain one in polynomial random time.

Alternate statement
A related lemma is the distributional JL lemma. This lemma states that for any $$ 0 < \varepsilon, \delta < 1/2 $$ and positive integer $$ d $$, there exists a distribution over $$ \mathbb{R}^{k \times d} $$ from which the matrix $$ A $$ is drawn such that for $$ k = O(\varepsilon^{-2} \log(1/\delta)) $$ and for any unit-length vector $$ x \in \mathbb{R}^{d} $$, the claim below holds.
 * $$ P(|\Vert Ax\Vert_2^2-1|>\varepsilon)<\delta$$

One can obtain the JL lemma from the distributional version by setting $$x = (u-v)/\|u-v\|_2$$ and $$\delta < 1/n^2$$ for some pair u,v both in X. Then the JL lemma follows by a union bound over all such pairs.

Speeding up the JL transform
Given A, computing the matrix vector product takes $$O(kd)$$ time. There has been some work in deriving distributions for which the matrix vector product can be computed in less than $$O(kd)$$ time.

There are two major lines of work. The first, Fast Johnson Lindenstrauss Transform (FJLT), was introduced by Ailon and Chazelle in 2006. This method allows the computation of the matrix vector product in just $$d\log d + k^{2+\gamma}$$ for any constant $$\gamma>0$$.

Another approach is to build a distribution supported over matrices that are sparse. This method allows keeping only an $$\varepsilon$$ fraction of the entries in the matrix, which means the computation can be done in just $$kd\varepsilon$$ time. Furthermore, if the vector has only $$b$$ non-zero entries, the Sparse JL takes time $$kb\varepsilon$$, which may be much less than the $$d\log d$$ time used by Fast JL.

Tensorized random projections
It is possible to combine two JL matrices by taking the so-called face-splitting product, which is defined as the tensor products of the rows (was proposed by V. Slyusar in 1996    for radar and digital antenna array applications). More directly, let $${C}\in\mathbb R^{3\times 3}$$ and $${D}\in\mathbb R^{3\times 3}$$ be two matrices. Then the face-splitting product $${C}\bullet {D}$$ is

{C} \bullet {D} = \left[ \begin{array} { c } {C}_1 \otimes {D}_1\\\hline {C}_2 \otimes {D}_2\\\hline {C}_3 \otimes {D}_3\\ \end{array} \right]. $$ This idea of tensorization was used by Kasiviswanathan et al. for differential privacy.

JL matrices defined like this use fewer random bits, and can be applied quickly to vectors that have tensor structure, due to the following identity:
 * $$(\mathbf{C} \bull \mathbf{D})(x\otimes y) = \mathbf{C}x \circ \mathbf{D} y

= \left[ \begin{array} { c } (\mathbf{C}x)_1 (\mathbf{D} y)_1 \\ (\mathbf{C}x)_2 (\mathbf{D} y)_2 \\ \vdots \end{array}\right] $$, where $$\circ$$ is the element-wise (Hadamard) product. Such computations have been used to efficiently compute polynomial kernels and many other.

In 2020 it was shown that if the matrices $$C_1, C_2, \dots, C_c$$ are independent $$\pm1$$ or Gaussian matrices, the combined matrix $$C_1 \bullet \dots \bullet C_c$$ satisfies the distributional JL lemma if the number of rows is at least
 * $$O(\epsilon^{-2}\log1/\delta + \epsilon^{-1}(\tfrac1c\log1/\delta)^c)$$.

For large $$\epsilon$$ this is as good as the completely random Johnson-Lindenstrauss, but a matching lower bound in the same paper shows that this exponential dependency on $$(\log1/\delta)^c$$ is necessary. Alternative JL constructions are suggested to circumvent this.