Acceleration of Randomized Kaczmarz Method via the Johnson-Lindenstrauss Lemma
Yonina C. Eldar, Deanna Needell
Introduction
The Kaczmarz method is a popular algorithm for solving overdetermined consistent systems of linear equations. Due to its simplicity and speed, it has been used in a variety of applications ranging from tomography to digital signal processing . The method uses a series of alternating projections to iteratively converge to the solution of , and is therefore computationally feasible even for very large systems. Given an initial guess and denoting by the rows of the matrix , each iteration of the method orthogonally projects the current estimation onto the next hyperplane defined as the solutions to , chosen in a cyclic fashion. The algorithm can be described by the iterations:
where is the iterate, (here and throughout) denotes the th coordinate of , and mod .
Although this technique has been used in practice for quite some time, theoretical guarantees on convergence were difficult to obtain . It is clear that by design of the algorithm, the convergence rate depends on the ordering of the rows in . Therefore, poorly ordered rows can lead to slower convergence. To overcome this difficulty, the rows of can be selected in a random fashion. It has been observed that this randomized version of the algorithm improves the convergence rate , however only recently have theoretical results been obtained .
In , Strohmer and Vershynin propose at each iteration to randomly select a row of with probability proportional to the Euclidean norm of the row. The randomized Kaczmarz (RK) method can thus be described by
where takes values in with probabilities . Here and throughout, denotes the Frobenius norm of and denotes the standard Euclidean norm or spectral norm for vectors or matrices, respectively. The selection rule used here is not optimal in general. The motivation for setting the rule according to the weight of the row norms is two-fold. First, it allows for a guarantee of expected exponential convergence for the Kaczmarz method . Second, it is a computationally efficient strategy since often these values will be known approximately or exactly, and will only need to be computed once. A selection rule of this type is of course also related to the idea of preconditioning the matrix by scaling its rows. Although other diagonal preconditioners may certainly perform better in general, finding such an optimal preconditioner is itself an optimization problem of high complexity. With the above selection strategy, the following exponential bound was shown in for the convergence in expectation of this randomized method:
The empirical and theoretical benefits of this approach lead one to ask whether it is also accurate in the more realistic case when noise is present. One may thus consider the (now possibly inconsistent) system where is an arbitrary error vector that has been added to the consistent system . It is shown in that in this case we have exponential convergence to the solution within an error factor:
where is the same as above and . It is also shown that this bound is sharp and is attained even for simple examples .
2 Modified approach
Implementation and Runtime
Since the projections in the algorithm are orthogonal, one easily sees that the optimal projection in the th iteration would be the one that maximizes , or equivalently, the term
for all , where is an absolute constant.
Remark. The value of in which this lemma holds depends on the distribution from which is created. When is Gaussian, one has .
In our setting, the Johnson-Lindenstrauss Lemma allows us to project the rows of as well as the estimations onto a space of substantially lower dimension. This will then let us approximately calculate the terms in (2.1) using far fewer operations, which we can use to decide on which hyperplane to project the current estimate. We note that the projection of the rows of will be performed offline, adding to the preprocessing time, whereas the projection of the estimation will be done at each iteration. We choose to use an analagous strategy as in the RK algorithm for our row selection; that is, using the weight of the row norms. This choice yields a worst case convergence rate which is the same as that guaranteed by the original RK method (see Remark 2 below). This leads to the following modified randomized Kaczmarz method, called Randomized Kaczmarz via Johnson-Lindenstrauss (RKJL) which can be summarized as follows.
Randomized Kaczmarz via Johnson-Lindenstrauss (RKJL)
2. In the Test stage of the algorithm, we see that in addition to approximating the inner products, we also exactly calculate the inner product of a randomly selected row and also the row that was chosen. This will guarantee that the convergence is not slowed by any drastic consequences of the error in the approximations, and does not affect the overall runtime.
3. We note that the initialization step may of course be computationally expensive, as is calculating the probabilities in the standard version (1.1). However, this need only be done once, and thus this version of the algorithm will be beneficial for situations in which the same matrix is used in many problems. This is the case for many applications such as the wave-scattering problem and structural mechanics problems ; see for others.
We next turn to an analysis of this modified method. In Section 4 we provide numerical results demonstrating the improved convergence rate.
2 Runtime
Analytical Justification
We next analyze how the Johnson-Lindenstrauss Lemma is utilized by our method. We will assume here that the system is real-valued and homogeneous (ie. ), that the rows of all have unit norm, and that the initial guess also satisfies . These assumptions are of course not necessary, but will make the analysis simpler. We discuss the case where the row norms may be far from equal in Remark 3 below. We begin with an easy lemma which shows that the geometry of the vectors used in the RKJL method is approximately preserved.
Similarly we have that , which completes the claim.
This shows that the terms used for selection in the algorithm are approximately equal to the actual desired values . Thus for small, the RKJL algorithm makes well educated decisions at each iteration which allows for quicker convergence (see Theorem 3.2 below). This also shows that when the estimation becomes very close to the true solution , the error begins to dominate and improvements may no longer be expected. However, this does not pose a problem since it only occurs when the estimate is already approximately .
It is clear from construction of the RKJL algorithm (and especially in light of Remark 2 above), that convergence using RKJL is at least as fast as the standard randomized version. Moreover, when the error produced by applying is small, the RKJL method will project onto the “best” hyperplane out of those it selected in that iteration. Since the probability of choosing this “best” row when selecting only a single row is strictly less than the probability of choosing that row when a set of rows is selected, this implies that the only case in which RKJL would not provide a strictly faster convergence rate is when for all rows , selected in the th iteration.
Given a current estimate , one can explicitly compare the expectation of the improvement the next estimation provides, for both the RKJL and standard randomized methods. First observe that if denotes the projection in the th iteration, then resides in the kernel of , and is thus orthogonal to the space onto which projects. This space contains since is the solution to all equations and . Therefore, and are orthogonal, implying that
The relation (3.1) shows that the larger , the bigger the improvement made in that iteration. We thus fix an estimation and analyze the expectation of for the RKJL method versus the standard one. For convenience, we again consider the real and homegenous case (ie. when ), and assume the rows of have unit norms. We then have the following result.
Fix an estimation and denote by and the next estimations using the RKJL and the standard RK method, respectively. Set and reorder these so that . Then when ,
are non-negative values satisfying and .
Proof. Since we assume the rows of have unit norm and that , we see that is precisely the value of if the algorithm were to select row . We begin by examining the th RKJL iteration.
Let denote the set of rows chosen in the selection step, so that . If exact geometry were preserved (i.e. ), then the method would simply select the index of the largest contained in . However, due to the error induced by , even when the “best” row is selected to be in , the algorithm may not choose this row for the projection.
We thus define sets for , which consist of rows which could be “confused” in this way,
From Lemma 3.1, if and , then the worst row we could choose is one that would give . Therefore,
Since each row of has equal norm, each of is equally likely to be selected in . Thus
Lemma 3.1 and the definition of guarantee that . This along with the fact that yields
Finally, since all the rows of have the same norm, the standard RK method selects each row uniformly at random, so that
Combining (3.3) with (3.2) and (3.1) we have
Remarks. 1. Theorem 3.2 gives a lower bound, which shows improvements in the “worst case”, when the error induced by the Johnson-Lindenstrauss projection causes the method to choose a row of in the worst way. Numerical experiments (as seen in the next section) demonstrate substantial improvements in the convergence rate.
2. Note that since the sequences and are non-increasing and , the sum is non-negative. Furthermore, only when . Indeed, if even for just one pair , then for small enough, the RKJL method provides strict convergence improvement. Knowledge of and would allow one to precisely calculate the improvement.
3. The theorem is proven under the assumption that the rows of have the same norm. The same argument holds (with different values of ) still showing improvement when this assumption does not hold, and numerical experiments show similar results in either case. Although the analysis of exact improvement in these other cases may quickly become quite complicated, we recall that by construction the RKJL method offers overall improvement in any case.
It is also helpful to identify some particularly interesting scenarios, for example, when one or a few rows are substantially of larger norm. In this case the standard RK algorithm (noticing that each row is selected independently of the previous selections) will choose this row repeatedly with high probability. Clearly this may slow convergence (especially when these rows are highly correlated), and although there is still guaranteed exponential convergence, in this case is much larger so that the guaranteed rate is slower. In RKJL, although the guaranteed worst case rate is the same, these large rows are likely not to be selected when their contributions toward the solution is minimal. This will again speed up convergence, since in the language of Theorem 3.2, the corresponding to the rows which are highly correlated with the previous projection will be such that . This means that the same argument as in Theorem 3.2 will hold for all with . Although this means the improvement in RKJL may not be as substantial as in the case of equal normed rows, we will still see a large improvement.
These ideas highlight the fact that the selection strategy is not optimal in general. For example, if there are rows which are highly uncorrelated but have very small norm, and equal rows with substantially larger norm, neither RK nor RKJL will perform well. Of course if this were reversed, with the uncorrelated rows having large norm and the equal rows having small norm, the selection strategy will yield excellent convergence in both RK and especially RKJL. We emphasize again that the choice of the selection rule is certainly not optimal in general, but is computationally efficient and allows for provable expected exponential rate of convergence. Choosing an optimal selection strategy for a given system is itself a problem of high complexity. If one is using RKJL and investing preprocessing time to perform dimension reduction, one may also wish to simply normalize the rows to avoid such difficulties.
Theorem 3.2 implies the following corollary, showing the improved convergence using RKJL when exact geometry is preserved (i.e. when ).
Fix an estimation and denote by and the next estimations using the RKJL and the standard method, respectively. Set and reorder these so that . Then when exact geometry is preserved (),
Numerical Results
We now demonstrate improved convergence using the RKJL method. The first experiment we run is in the computationally infeasible situation where we do not use the Johnson-Lindenstrauss projection, but simply choose the best row out of the randomly selected rows. This experiment will demonstrate the improved convergence using RKJL when the error induced by goes to . This is the best improvement one can hope for in RKJL. When the problem sizes grow very large, the effect of the term in (2.2) becomes minimal, so it may be realistic to take quite small. For these simulations we use a matrix with Bernoulli entries and use a homogeneous system with an initial estimate chosen uniformly at random on the sphere. We see in Figure 1 that the convergence in this scenario is significantly improved.
This work is partially supported by the NSF DMS EMSW21-VIGRE grant and the Israel Science Foundation under Grant no. 1081/07. We would also like to thank Emmanuel Candès and Thomas Strohmer for helpful suggestions.