Kaczmarz method explained

The Kaczmarz method or Kaczmarz's algorithm is an iterative algorithm for solving linear equation systems

Ax=b

. It was first discovered by the Polish mathematician Stefan Kaczmarz, and was rediscovered in the field of image reconstruction from projections by Richard Gordon, Robert Bender, and Gabor Herman in 1970, where it is called the Algebraic Reconstruction Technique (ART). ART includes the positivity constraint, making it nonlinear.

The Kaczmarz method is applicable to any linear system of equations, but its computational advantage relative to other methods depends on the system being sparse. It has been demonstrated to be superior, in some biomedical imaging applications, to other methods such as the filtered backprojection method.

It has many applications ranging from computed tomography (CT) to signal processing. It can be obtained also by applying to the hyperplanes, described by the linear system, the method of successive projections onto convex sets (POCS).

Algorithm 1: Kaczmarz algorithm

Let

Ax=b

be a system of linear equations, let

m

be the number of rows of A,

ai

be the

i

th row of complex-valued matrix

A

, and let

x0

be arbitrary complex-valued initial approximation to the solution of

Ax=b

. For

k=0,1,\ldots

compute:

where

i=k\bmodm+1,i=1,2,\ldotsm

and

\overline{ai}

denotes complex conjugation of

ai

.

If the system is consistent,

xk

converges to the minimum-norm solution, provided that the iterations start with the zero vector.

A more general algorithm can be defined using a relaxation parameter

λk

xk+1=xk+λk

bi-\langleai,xk\rangle
\|ai\|2

\overline{ai

}

There are versions of the method that converge to a regularized weighted least squares solution when applied to a system of inconsistent equations and, at least as far as initial behavior is concerned, at a lesser cost than other iterative methods, such as the conjugate gradient method.[1]

Algorithm 2: Randomized Kaczmarz algorithm

In 2009, a randomized version of the Kaczmarz method for overdetermined linear systems was introduced by Thomas Strohmer and Roman Vershynin in which the i-th equation is selected randomly with probability proportional to

\|ai\|2.

This method can be seen as a particular case of stochastic gradient descent.

Under such circumstances

xk

converges exponentially fast to the solution of

Ax=b,

and the rate of convergence depends only on the scaled condition number

\kappa(A)

.

Theorem. Let

x

be the solution of

Ax=b.

Then Algorithm 2 converges to

x

in expectation, with the average error:

E\|xk-x\|2\leq\left(1-\kappa(A)-2\right)k\|x0-x\|2.

Proof

We have

Using

\|A

m
\|
j=1

\|aj\|2

we can write as

The main point of the proof is to view the left hand side in as an expectation of some random variable. Namely, recall that the solution space of the

j-th

equation of

Ax=b

is the hyperplane

\{y:\langley,aj\rangle=bj\},

whose normal is

\tfrac{aj}{\|aj\|2}.

Define a random vector Z whose values are the normals to all the equations of

Ax=b

, with probabilities as in our algorithm:
Z=aj
\|aj\|

with probability
\|aj\|2
\|A\|2

         j=1,\ldots,m

Then says that

The orthogonal projection

P

onto the solution space of a random equation of

Ax=b

is given by

Pz=z-\langlez-x,Z\rangleZ.

Now we are ready to analyze our algorithm. We want to show that the error

{\|xk-x\|2}

reduces at each step in average (conditioned on the previous steps) by at least the factor of

(1-\kappa(A)-2).

The next approximation

xk

is computed from

xk-1

as

xk=Pkxk-1,

where

P1,P2,\ldots

are independent realizations of the random projection

P.

The vector

xk-1-xk

is in the kernel of

Pk.

It is orthogonal to the solution space of the equation onto which

Pk

projects, which contains the vector

xk-x

(recall that

x

is the solution to all equations). The orthogonality of these two vectors then yields

\|xk-x\|2=\|xk-1-x\|2-\|xk-1-xk\|2.

To complete the proof, we have to bound

\|xk-1-xk\|2

from below. By the definition of

xk

, we have

\|xk-1-xk\|=\langlexk-1-x,Zk\rangle

where

Z1,Z2,\ldots

are independent realizations of the random vector

Z.

Thus

\|xk-x\|2\leq\left(1-\left|\left\langle

xk-1-x
\|xk-1-x\|

,

2\right){\|
Z
k\right\rangle\right|

xk-1-x\|2}.

Now we take the expectation of both sides conditional upon the choice of the random vectors

Z1,\ldots,Zk-1

(hence we fix the choice of the random projections

P1,\ldots,Pk-1

and thus the random vectors

x1,\ldots,xk-1

and we average over the random vector

Zk

). Then
E
Z1,\ldots,Zk-1

{\|xk-x\|2}=

\left(1-E\left|\left\langle
Z1,\ldots,Zk-1,Zk
xk-1-x
\|xk-1-x\|
2\right){\|
,Z
k\right\rangle\right|

xk-1-x\|2}.

By and the independence,

E
Z1,\ldots,Zk-1

{\|xk-x\|2}\leq(1-\kappa(A)-2){\|xk-1-x\|2}.

Taking the full expectation of both sides, we conclude that

E\|xk-x\|2\leq(1-\kappa(A)-2)E{\|xk-1-x\|2}.\blacksquare

The superiority of this selection was illustrated with the reconstruction of a bandlimited function from its nonuniformly spaced sampling values. However, it has been pointed out that the reported success by Strohmer and Vershynin depends on the specific choices that were made there in translating the underlying problem, whose geometrical nature is to find a common point of a set of hyperplanes, into a system of algebraic equations. There will always be legitimate algebraic representations of the underlying problem for which the selection method in will perform in an inferior manner.

The Kaczmarz iteration has a purely geometric interpretation: the algorithm successively projects the current iterate onto the hyperplane defined by the next equation. Hence, any scaling of the equations is irrelevant; it can also be seen from that any (nonzero) scaling of the equations cancels out. Thus, in RK, one can use

\|ai\|

or any other weights that may be relevant. Specifically, in the above-mentioned reconstruction example, the equations were chosen with probability proportional to the average distance of each sample point from its two nearest neighbors — a concept introduced by Feichtinger and Gröchenig. For additional progress on this topic, see, and the references therein.

Algorithm 3: Gower-Richtarik algorithm

In 2015, Robert M. Gower and Peter Richtarik developed a versatile randomized iterative method for solving a consistent system of linear equations

Ax=b

which includes the randomized Kaczmarz algorithm as a special case. Other special cases include randomized coordinate descent, randomized Gaussian descent and randomized Newton method. Block versions and versions with importance sampling of all these methods also arise as special cases. The method is shown to enjoy exponential rate decay (in expectation) - also known as linear convergence, under very mild conditions on the way randomness enters the algorithm. The Gower-Richtarik method is the first algorithm uncovering a "sibling" relationship between these methods, some of which were independently proposed before, while many of which were new.

Insights about Randomized Kaczmarz

Interesting new insights about the randomized Kaczmarz method that can be gained from the analysis of the method include:

A

. There are problems for which the standard probabilities are optimal.

A

which is positive definite, Randomized Kaczmarz method is equivalent to the Stochastic Gradient Descent (SGD) method (with a very special stepsize) for minimizing the strongly convex quadratic function

f(x)=\tfrac{1}{2}xTAx-bTx.

Note that since

f

is convex, the minimizers of

f

must satisfy

\nablaf(x)=0

, which is equivalent to

Ax=b.

The "special stepsize" is the stepsize which leads to a point which in the one-dimensional line spanned by the stochastic gradient minimizes the Euclidean distance from the unknown(!) minimizer of

f

, namely, from

x*=A-1b.

This insight is gained from a dual view of the iterative process (below described as "Optimization Viewpoint: Constrain and Approximate").

Six Equivalent Formulations

The Gower-Richtarik method enjoys six seemingly different but equivalent formulations, shedding additional light on how to interpret it (and, as a consequence, how to interpret its many variants, including randomized Kaczmarz):

We now describe some of these viewpoints. The method depends on 2 parameters:

B

giving rise to a weighted Euclidean inner product

\langlex,y\rangleB:=xTBy

and the induced norm

\|x\|B=\left(\langlex,x\rangleB\right

1
2
)

,

S

with as many rows as

A

(and possibly random number of columns).

1. Sketch and Project

Given previous iterate

xk,

the new point

xk+1

is computed by drawing a random matrix

S

(in an iid fashion from some fixed distribution), and setting

xk+1=\undersetx\operatorname{argmin}\|x-xk\|BsubjecttoSTAx=STb.

That is,

xk+1

is obtained as the projection of

xk

onto the randomly sketched system

STAx=STb

. The idea behind this method is to pick

S

in such a way that a projection onto the sketched system is substantially simpler than the solution of the original system

Ax=b

. Randomized Kaczmarz method is obtained by picking

B

to be the identity matrix, and

S

to be the

ith

unit coordinate vector with probability

pi=

2
\|a
2/\|A\|
2.
F
Different choices of

B

and

S

lead to different variants of the method.

2. Constrain and Approximate

A seemingly different but entirely equivalent formulation of the method (obtained via Lagrangian duality) is

xk+1=\undersetx\operatorname{argmin}\left\|x-x*\right\|Bsubjecttox=xk+B-1ATSy,

where

y

is also allowed to vary, and where

x*

is any solution of the system

Ax=b.

Hence,

xk+1

is obtained by first constraining the update to the linear subspace spanned by the columns of the random matrix

B-1ATS

, i.e., to

\left\{h:h=B-1ATSy,ycanvary\right\},

and then choosing the point

x

from this subspace which best approximates

x*

. This formulation may look surprising as it seems impossible to perform the approximation step due to the fact that

x*

is not known (after all, this is what we are trying the compute!). However, it is still possible to do this, simply because

xk+1

computed this way is the same as

xk+1

computed via the sketch and project formulation and since

x*

does not appear there.

5. Random Update

The update can also be written explicitly as

xk+1=xk-B-1ATS\left(STAB-1ATS\right)\daggerST\left(Axk-b\right),

where by

M\dagger

we denote the Moore-Penrose pseudo-inverse of matrix

M

. Hence, the method can be written in the form

xk+1=xk+hk

, where

hk

is a random update vector.

Letting

M=STAB-1ATS,

it can be shown that the system

My=ST(Axk-b)

always has a solution

yk

, and that for all such solutions the vector

xk+1-B-1ATSyk

is the same. Hence, it does not matter which of these solutions is chosen, and the method can be also written as

xk+1=xk-B-1ATSyk

. The pseudo-inverse leads just to one particular solution. The role of the pseudo-inverse is twofold:

6. Random Fixed Point

If we subtract

x*

from both sides of the random update formula, denote

Z:=ATS\left(STAB-1ATS\right)\daggerSTA,

and use the fact that

Ax*=b,

we arrive at the last formulation:

xk+1-x*=\left(I-B-1Z\right)\left(xk-x*\right),

where

I

is the identity matrix. The iteration matrix,

I-B-1Z,

is random, whence the name of this formulation.

Convergence

By taking conditional expectations in the 6th formulation (conditional on

xk

), we obtain

E\left.\left[xk+1-x*\right|xk\right]=\left(I-B-1E[Z]\right)\left[xk-x*\right].

By taking expectation again, and using the tower property of expectations, we obtain

E\left[xk+1-x*\right]=(I-B-1E[Z])E\left[xk-x*\right].

Gower and Richtarik show that

\rho:=\left

-1
2
\|I-B
-1
2
E[Z]B

\right\|B=λmax\left(I-B-1E[Z]\right),

where the matrix norm is defined by

\|M\|B:=maxx

\|Mx\|B
\|x\|B

.

Moreover, without any assumptions on

S

one has

0\leq\rho\leq1.

By taking norms and unrolling the recurrence, we obtain

Theorem [Gower & Richtarik 2015]

\left\|E\left[xk-x*\right]\right\|B\leq\rhok\|x0-x*\|B.

Remark. A sufficient condition for the expected residuals to converge to 0 is

\rho<1.

This can be achieved if

A

has a full column rank and under very mild conditions on

S.

Convergence of the method can be established also without the full column rank assumption in a different way.

It is also possible to show a stronger result:

Theorem [Gower & Richtarik 2015]

The expected squared norms (rather than norms of expectations) converge at the same rate:

E\left\|\left[xk-x*\right]\right

2
\|
B

\leq\rhok\left\|x0-x*\right

2
\|
B.

Remark. This second type of convergence is stronger due to the following identity which holds for any random vector

x

and any fixed vector

x*

:

\left\|E\left[x-x*\right]\right\|2=E\left[\left\|x-x*\right\|2\right]-E\left[\|x-E[x]\|2\right].

Convergence of Randomized Kaczmarz

We have seen that the randomized Kaczmarz method appears as a special case of the Gower-Richtarik method for

B=I

and

S

being the

ith

unit coordinate vector with probability

pi=\|ai\|

2,
F
where

ai

is the

ith

row of

A.

It can be checked by direct calculation that

\rho=\|I-B-1E[Z]\|B=1-

λmin(ATA)
2
\|A\|
F

.

Further Special Cases

Algorithm 4: PLSS-Kaczmarz

Since the convergence of the (randomized) Kaczmarz method depends on a rate of convergence the method may make slow progress on some practical problems. To ensure finite termination of the method, Johannes Brust and Michael Saunders (academic) have developed a process that generalizes the (randomized) Kaczmarz iteration andterminates in at most

m

iterations to a solution for the consistent system

Ax=b

. The process is based on Dimensionality reduction, or projectionsonto lower dimensional spaces, which is how it derives its name PLSS (Projected Linear Systems Solver). An iteration of PLSS-Kaczmarz can be regarded as the generalization

xk+1=xk+

T
A
:,1:k

(A1:k,:

T
A
:,1:k

)\dagger(b1:k-A1:k,:xk)

where

A1:k,:

is the selection of rows 1 to

k

and all columns of

A

. A randomized version of the method uses

k

non repeated row indices at each iteration:

\{i1,\ldots,ik-1,ik\}

where each

ij

is in

1,2,...,m

.The iteration converges to a solution when

k=m

. In particular, since

A1:m,:=A

it holds that

Axm+1=Axm+AAT(AAT)\dagger(b-Axm)=b

and therefore

xm+1

is a solution to the linear system. The computation of iterates in PLSS-Kaczmarz can be simplified and organized effectively.The resulting algorithm only requires matrix-vector products and has a direct form

algorithm PLSS-Kaczmarz is input: matrix A right hand side b output: solution x such that Ax=b x := 0, P = [0] for k in 1,2,...,m do a := A(ik,:)' // Select an index ik in 1,...,m without resampling d := P' * a c1 := norm(a) c2 := norm(d) c3 := (bik-x'*a)/((c1-c2)*(c1+c2)) p := c3*(a - P*(P'*a)) P := [P, p/norm(p) ] // Append a normalized update x := x + p return x

References

External links

Notes and References

  1. See and references therein.