Statistical physics-based reconstruction in compressed sensing
Florent Krzakala, Marc Mézard, François Sausset, Yifan Sun, Lenka Zdeborová
Reconstruction in Compressed Sensing
The mathematical problem posed in compressed-sensing reconstruction is easily stated. Given an unknown signal which is a -dimensional vector s, we make measurements, where each measurement amounts to a projection of s on some known vector. The measurements are grouped into a -component vector y, which is obtained from s by a linear transformation . Depending on the application, this linear transformation can be for instance associated with measurements of Fourier modes or wavelet coefficients. The observer knows the matrix F and the measurements y, with . His aim is to reconstruct s. This is impossible in general, but compressed sensing deals with the case where the signal s is sparse, in the sense that only of its components are non-zero. We shall study the case where the non-zero components are real numbers and the measurements are linearly independent. In this case, exact signal reconstruction is possible in principle whenever , using an exhaustive enumeration method which tries to solve for all possible choices of locations of non-zero components of x: only one such choice gives a consistent linear system, which can then be inverted. However, one is typically interested in large instances where , with and . The enumeration method solves the compressed sensing problem in the regime where measurement rates are at least as large as the signal density, , but in a time which grows exponentially with , making it totally impractical. Therefore is the fundamental reconstruction limit for perfect reconstruction in the noiseless case, when the non-zero components of the signal are real numbers drawn from a continuous distribution. A general and detailed discussion of information-theoretically optimal reconstruction has been developed recently in Wu & Verdu (2011a, b); Guo et al. (2009).
A probabilistic approach
For the purpose of our analysis, we consider the case where the signal s has independent identically distributed (iid) components: , with . In the large- limit the number of non-zero components is . Our approach handles general distributions .
Assuming that F is a random matrix, either where all the elements are drawn as independent Gaussian random variables with zero mean and the same variance, or of the carefully-designed type of ‘seeding matrices’ described below, we demonstrate in Appendix A that, for any -dense original signal s, and any the probability of the original signal goes to one when . This result holds independently of the distribution of the original signal, which does not need to be known. In practice, we see that s also dominates the measure when is not very large. In principle, sampling configurations x proportionally to the restricted Gauss-Bernoulli measure thus gives asymptotically the exact reconstruction in the whole region . This idea stands at the roots of our approach, and is at the origin of the connection with statistical physics (where one samples with the Boltzmann measure).
Sampling with Expectation Maximization Belief Propagation
The exact sampling from a distribution such as , eq. (2), is known to be computationally intractable Natarajan (1995). However, an efficient approximate sampling can be performed using a message-passing procedure that we now describe Thouless et al. (1977); Tanaka (2002); Guo & Wang (2006); Rangan (2010). We start from the general belief-propagation formalism Kschischang et al. (2001); Yedidia et al. (2003); Mézard & Montanari (2009): for each measurement and each signal component , one introduces a ‘message’ which is the probability of in a modified measure where measurement has been erased. In the present case, the canonical belief propagation equations relating these messages can be simplified Donoho et al. (2009, 2010); Rangan (2010, 2011); Montanari & Bayati (2011) into a closed form that uses only the expectation and the variance of the distribution (see Appendix B). An important ingredient that we add to this approach is the learning of the parameters in : the density , and the mean and variance of the Gaussian distribution . These are three parameters to be learned using update equations based on the gradient of the so-called Bethe free entropy, in a way analogous to the expectation maximization Dempster et al. (1977); Iba (1999); Decelle et al. (2011). This leads to the Expectation Maximization Belief Propagation (EM-BP) algorithm that we will use in the following for reconstruction in compressed sensing. It consists in iterating the messages and the three parameters, starting from random messages and , until a fixed point is obtained. Perfect reconstruction is found when the messages converge to the fixed point and .
Designing seeding matrices
In order for the EM-BP message-passing algorithm to be able to reconstruct the signal down to the theoretically optimal number of measurements , one needs to use a special family of measurement matrices F that we call ‘seeding matrices’. If one uses an unstructured F, for instance a matrix with independent Gaussian-distributed random elements, EM-BP samples correctly at large , but at small enough a metastable state appears in the measure , and the EM-BP algorithm is trapped in this state, and is therefore unable to find the original signal (see Fig. 3), just as a supercooled liquid gets trapped in a glassy state instead of crystallizing. It is well known in crystallization theory that the crucial step is to nucleate a large enough seed of crystal. This is the purpose of the following design of F.
We divide the variables into groups of variables, and the measurements into groups. The number of measurements in the -th group is , so that . We then choose the matrix elements independently, in such a way that, if belongs to group and to group then is a random number chosen from the normal distribution with mean zero and variance (see Fig. 4). The matrix is a coupling matrix (and the standard compressed sensing matrices are obtained using and ). Using these new matrices, one can shift the BP phase transition very close to the theoretical limit. In order to get an efficient reconstruction with message passing, one should use a large enough . With a good choice of the coupling matrix , the reconstruction first takes place in the first block, and propagates as a wave in the following blocks , even if their measurement rate is small. In practice, we use , so that the total measurement rate is . The whole reconstruction process is then analogous to crystal nucleation, where a crystal is growing from its seed (see Fig. 5). Similar ideas have been used recently in the design of sparse coding matrices for error-correcting codes Jimenez Felstrom & Zigangirov (1999); Kudekar et al. (2010); Lentmaier & Fettweis (2010); Hassani et al. (2010).
Analysis of the performance of the seeded Belief Propagation procedure
The s-BP procedure is based on the joint use of seeding measurement matrices and of the EM-BP message-passing reconstruction. We have studied it with two methods: direct numerical simulations and analysis of the performance in the large limit. The analytical result was obtained by a combination of the replica method and of the cavity method (also known as ‘density evolution’ or ‘state evolution’). The replica method is a standard method in statistical physics Mézard et al. (1987), which has been applied successfully to several problems of information theory Nishimori (2001); Tanaka (2002); Guo & Verdú (2005); Mézard & Montanari (2009) including compressed sensing Rangan et al. (2009); Kabashima et al. (2009); Ganguli & Sompolinsky (2010). It can be used to compute the free entropy function associated with the probability (see Appendix D), and the cavity method shows that the dynamics of the message-passing algorithm is a gradient dynamics leading to a maximum of this free-entropy.
When applied to the usual case of the full F matrix with independent Gaussian-distributed elements (case ), the replica computation shows that the free-entropy for configurations constrained to be at a mean-squared distance has a global maximum at when , which confirms that the Gauss-Bernoulli probabilistic reconstruction is in principle able to reach the optimal compression limit . However, for , where is a threshold that depends on the signal and on the distribution , a secondary local maximum of appears at (see Fig. 3). In this case the EM-BP algorithm converges instead to this secondary maximum and does not reach exact reconstruction. The threshold is obtained analytically as the smallest value of such that is decreasing (Fig. 2). This theoretical study has been confirmed by numerical measurements of the number of iterations needed for EM-BP to reach its fixed point (within a given accuracy). This convergence time of BP to the exact reconstruction of the signal diverges when (see Fig. 3). For the EM-BP algorithm converges to a fixed point with strictly positive mean-squared error (MSE). This ‘dynamical’ transition is similar to the one found in the cooling of liquids which go into a super-cooled glassy state instead of crystallizing, and appears in the decoding of error correcting codes Richardson & Urbanke (2008); Mézard & Montanari (2009) as well.
We have applied the same technique to the case of seeding-measurement matrices (). The cavity method allows to analytically locate the dynamical phase transition of s-BP. In the limit of large , the MSE and the variance messages in each block , the density , the mean , and the variance of evolve according to a dynamical system which can be computed exactly (see Appendix E), and one can see numerically if this dynamical system converges to the fixed point corresponding to exact reconstruction ( for all ). This study can be used to optimize the design of the seeding matrix F by choosing , and in such a way that the convergence to exact reconstruction is as fast as possible. In Fig. 3 we show the convergence time of s-BP predicted by the replica theory for different sets of parameters. For optimized values of the parameters, in the limit of a large number of blocks , and large system sizes , s-BP is capable of exact reconstruction close to the smallest possible number of measurements, . In practice, finite size effects slightly degrade this asymptotic threshold saturation, but the s-BP algorithm nevertheless reconstructs signals at rates close to the optimal one regardless of the signal distribution, as illustrated in Fig. 2.
Perspectives
The seeded compressed sensing approach introduced here is versatile enough to allow for various extensions. One aspect worth mentioning is the possibility to write the EM-BP equations in terms of messages instead of the parameters as described in Appendix C. This is basically the step that goes from rBP Rangan (2010) to AMP Donoho et al. (2009) algorithm. It could be particularly useful when the measurement matrix has some special structure, so that the measurements y can be obtained in many fewer than operations (typically in operations). We have also checked that the approach is robust to the introduction of a small amount of noise in the measurements (see Appendix H). Finally, let us mention that, in the case where a priori information on the signal is available, it can be incorporated in this approach through a better choice of , and considerably improve the performance of the algorithm. For signal with density , the worst case, that we addressed here, is when the non-zero components of the signal are drawn from a continuous distribution. Better performance can be obtained with our method if these non-zero components come from a discrete distribution and one uses this distribution in the choice of . Another interesting direction in which our formalism can be extended naturally is the use of non-linear measurements and different type of noises. Altogether, this approach turns out to be very efficient both for random and structured data, as illustrated in Fig. 1, and offers an interesting perspective for fpractical compressed sensing applications. Data and code are available online at noteASPICS (7).
Acknowledgements We thank Y. Kabashima, R. Urbanke and specially A. Montanari for useful discussions. This work has been supported in part by the EC grant ‘STAMINA’, No 265496, and by the grant DySpaN of ‘Triangle de la Physique’.
Note: During the review process for our paper, we became aware of the work Donoho et al. (2011) in which the authors give a rigorous proof of our result, in the special case when and , that the threshold can be reached asymptotically by the s-BP procedure.
Appendix A Proof of the optimality of the probabilistic approach
Here we give the main lines of the proof that our probabilistic approach is asymptotically optimal. We consider the case where the signal s has iid components
with . And we study the probability distribution
with a Gaussian of mean zero and unit variance. We stress here that we consider general , i.e. is not necessarily equal to (and is not necessarily equal to ). The measurement matrix F is composed of iid elements such that if belongs to block and belongs to block then is a random number generated from the Gaussian distribution with zero mean and variance /N. The function is a centered Gaussian distribution with variance .
We show that, with probability going to one in the large limit (at fixed ), the measure (obtained with a generic seeding matrix F as described in the main text) is dominated by the signal if , (as long as is finite).
We introduce the constrained partition function:
The proof of optimality is obtained by showing that, under the conditions above, is finite if (statement 1), and it vanishes if (statement 2). This proves that the measure is dominated by , i.e. by the neighborhood of the signal . The standard ‘self-averageness’ property, which states that the distribution (with respect to the choice of F and s) of concentrates around when , completes the proof. We give here the main lines of the first two steps of the proof.
We first sketch the proof of statement 2. The fact that when can be derived by a first moment bound:
where is the ‘annealed partition function’ defined as
In order to evaluate one can first compute the annealed partition function in which the distances between and the signal are fixed in each block. More precisely, we define
By noticing that the random variables are independent Gaussian random variables one obtains:
The behaviour of is easily obtained by standard saddle point methods. In particular, when , one has .
Using (6), we obtain, in the small limit:
where the maximum over is to be taken under the constraint . Taking the limit of with a finite , at least one of the distance must remain finite. It is then easy to show that
where is the fraction of measurements in blocks to . As , this is less singular than , which proves statement 2.
On the contrary, when , we obtain from the same analysis
This annealed estimate actually gives the correct scaling at small , as can be shown by the following lower bound. When , we define as the subset of indices where , , and as the subset of indices where , . We obtain a lower bound on by substituting by the factors when and when . This gives:
where . The matrix , of size , is a Wishart-like random matrix. For , generically, its eigenvalues are strictly positive, as we show below. Using this property, one can show that, if , the integral over the variables in (11) is strictly positive in the limit . The divergence of in the limit is due to the explicit term in Eq. (11).
The fact that all eigenvalues of are strictly positive is well known in the case of where the spectrum has been obtained by Marcenko and Pastur. In general, the fact that all the eigenvalues of are strictly positive is equivalent to saying that all the lines of the matrix (which is the restriction of the measurement matrix to columns with non-zero signal components) are linearly independent. In the case of seeding matrices with general , this statement is basically obvious by construction of the matrices, in the regime where in each block , and . A more formal proof can be obtained as follows. We consider the Gaussian integral
Appendix B Derivation of Expectation maximization Belief Propagation
In this and the next sections we present the message-passing algorithm that we used for reconstruction in compressed sensing. In this section we derive its message-passing form, where messages are being sent between each signal component and each measurement . This algorithm was used in Rangan (2010), where it was called the relaxed belief propagation, as an approximate algorithm for the case of a sparse measurement matrix F. In the case that we use here of a measurement matrix which is not sparse (a finite fraction of the elements of F is non-zero, and all the non-zero elements scale as ), the algorithm is asymptotically exact. We show here for completeness how to derive it. In the next section we then derive asymptotically equivalent equations that depend only on messages. In statistical physics terms, this corresponds to the TAP equations Thouless et al. (1977) with the Onsager reaction term, that are asymptotically equivalent to the BP on fully connected models. In the context of compressed sensing this form of equations has been used previously Donoho et al. (2009) and it is called approximate message passing (AMP). In cases when the matrix F can be computed recursively (e.g. via fast Fourier transform), the running time of the AMP-type message passing is (compared to the for the non-AMP form). Apart for this speed-up, both classes of message passing give the same performance.
We derive here the message-passing algorithm in the case where measurements have additive Gaussian noise, the noiseless case limit is easily obtained in the end. The posterior probability of x after the measurement of y is given by
where is a normalization constant (the partition function) and is the variance of the noise in measurement . The noiseless case is recovered in the limit . The optimal estimate, that minimizes the MSE with respect to the original signal s, is obtained from averages of with respect to the probability measure . Exact computation of these averages would require exponential time, belief propagation provides a standard approximation. The canonical BP equations for probability measure read
where and are normalization factors ensuring that . These are integral equations for probability distributions that are still practically intractable in this form. We can, however, take advantage of the fact that after proper rescaling the linear system is such a way that elements of y and x are of , the matrix has random elements with variance of . Using the Hubbard-Stratonovich transformation
for we can simplify eq. (16) as
Now we expand the last exponential around zero because the term is small in , we keep all terms that are of . Introducing means and variances as new messages
Performing the Gaussian integral over we obtain
To close the equations on messages and we notice that
Messages and are respectively the mean and variance of the probability distribution . For general the mean and variance (20-21) will be computed using numerical integration over . Eqs. (20-21) together with (24-25) and (26) then lead to closed iterative message-passing equations.
In all the specific examples shown here and in the main part of the paper we used a Gaussian with mean and variance . We define two functions
where the and are the mean and variance of the marginal probabilities of variable .
As we discussed in the main text the parameters , and are usually not known in advance. However, their values can be learned within the probabilistic approach. A standard way to do so is called expectation maximization Dempster et al. (1977). One realizes that the partition function
is proportional to the probability of the true parameters given the measurement y. Hence to compute the most probable values of parameters one searches for the maximum of this partition function. Within the BP approach the logarithm of the partition function is the Bethe free entropy expressed asMézard & Montanari (2009)
The stationarity conditions of Bethe free entropy (32) with respect to leads to
where , and . Stationarity with respect to and gives
In statistical physics conditions (36) are known under the name Nishimori conditions Iba (1999); Nishimori (2001). In the expectation maximization eqs. (36-38) they are used iteratively for the update of the current guess of parameters. A reasonable initial guess is . The value of can also be obtained with a special line of measurement consisting of a unit vector, hence we assume that given estimate of the . In the case where the matrix F is random with Gaussian elements of zero mean and variance , we can also use for learning the variance: .
Appendix C AMP-form of the message passing
In the large limit, the messages and are nearly independent of , but one must be careful to keep the correcting Onsager reaction terms. Let us define
To express , we see that the first correction term has a contribution in , and can be safely neglected. On the contrary, the second term has a contribution in which one should keep. Therefore
The computation of is similar, it gives:
For a known form of matrix F these equations can be slightly simplified further by using the assumptions of the BP approach about independence of and BP messages. This plus a law of large number implies that for matrix F with Gaussian entries of zero mean and unit variance one can effectively ‘replace’ every by in eqs. (41,42) and (44,45). This leads, for homogeneous or bloc matrices, to even simpler equations and a slightly faster algorithm.
Eqs. (41,42) and (44,45), with or without the later simplification, give a system of closed equations. They are a special form ( and hence functions , are different in our case) of the approximate message passing of Donoho et al. (2009).
The final reconstruction algorithm for general measurement matrix and with learning of the parameters can hence be summarized in a schematic way: {codebox} \Procname \liInitialize randomly messages from interval $V_{i}\omega_{\mu}\leftarrow y_{\mu}\gamma_{\mu}]0,1]\rho\leftarrow\alpha\overline{x}\leftarrow 0\sigma^{2}\leftarrow 1{\rm conv}\leftarrow{\rm criterium}+1t\leftarrow 0{\rm conv}>{\rm criterium}t
For a general matrix F one iteration takes steps, we observed the number of iterations needed for convergence to be basically independent of , however, the constant depends on the parameters and the signal, see Fig. 3 in the main paper. For matrices that can be computed recursively (i.e. without storing all their elements) a speed-up is possible, as the message-passing loop takes only steps.
Appendix D Replica analysis and density evolution: full measurement matrix
In the case where the matrix F is the full measurement with all elements independent identically distributed from a normal distribution with zero mean and variance unity, one finds that is obtained as the saddle point value of the function:
Here is a Gaussian integration measure with zero mean and variance equal to one, is the density of the signal, and is the distribution of the signal components and is its second moment. is the variance of the measurement noise, the noiseless case is recovered by using .
The physical meaning of the order parameters is
Whereas the other three , , are auxiliary parameters. Performing saddle point derivative with respect to we obtain the following six self-consistent equations (using the Gaussian form of , with mean and variance ):
We now show the connection between this replica computation and the evolution of belief propagation messages, studying first the case where one does not change the parameters , and . Let us introduce parameters , , defined via the belief propagation messages as:
The density (state) evolution equations for these parameters can be derived in the same way as in Donoho et al. (2009); Montanari & Bayati (2011), and this leads to the result that , , evolve under the update of BP in exactly the same way as according to iterations of eqs. (50-52). Hence the analytical eqs. (50-52) allow to study the performance of the BP algorithm. Note also that the density evolution equations are the same for the message-passing and for the AMP equations. It turns out that the above equations close in terms of two parameters, the mean-squared error and the variance . From eqs. (49-52) easily gets a closed mapping .
In the main text we defined the function which is the free entropy restricted to configurations x for which is fixed. This is evaluated as the saddle point over of the function . This function is plotted in Fig. 3(a) of the main text.
In presence of Expectation Maximization learning of the parameters, the density evolution for the conditions (36) and (38) are
The density evolution equations now provide a mapping
obtained by complementing the previous equations on with the update equations (54,55,56). The next section gives explicitly the full set of equations in the case of seeding matrices, the ones for the full matrices are obtained by taking . These are the equations that we study to describe analytically the evolution of EM-BP algorithm and obtain the phase diagram for the reconstruction (see Fig. 2 in the main text).
Appendix E Replica analysis and density evolution for seeding-measurement matrices
Many choices of and actually work very well, and good performance for seeding-measurement matrices can be easily obtained. In fact, the form of the matrix that we have used is by no means the only one that can produce the seeding mechanism, and we expect that better choices, in terms of convergence time, finite-size effects and sensibility to noise, could be unveiled in the near future.
With the matrix presented in this work, and in order to obtain the best performance (in terms of phase transition limit and of speed of convergence) one needs to optimize the value of and depending on the type of signal. Fortunately, this can be analysed with the replica method. The analytic study in the case of seeding measurement matrices is in fact done using the same techniques as for the full matrix. The order parameters are now the MSE and variance in each block . Consequently, we obtain the final dynamical system of order parameters describing the density evolution of the s-BP algorithm. The order parameters at iteration of the message-passing algorithm are given by:
The functions , were defined in (27-28), and the function is defined as
This is the dynamical system that we use in the paper in the noiseless case () in order to optimize the values of , and . We can estimate the convergence time of the algorithm as the number of iterations needed in order to reach the successful fixed point (where all and vanish within some given accuracy). Figure 6 shows the convergence time of the algorithm as a function of and for Gauss-Bernoulli signals.
The numerical iteration of this dynamical system is fast. It allows to obtain the theoretical performance that can be achieved in an infinite- system. We have used it in particular to estimate the values of that have good performance. For Gauss-Bernoulli signals, using optimal choices of , we have found that perfect reconstruction can be obtained down to the theoretical limit by taking (with correction that scale as ). Recent rigorous work by Donoho, Javanmard and Montanari Donoho et al. (2011) extends our work and proves our claim that s-BP can reach the optimal threshold asymptotically.
Practical numerical implementation of s-BP matches this theoretical performance only when the size of every block is large enough (few hundreds of variables). In practice, for finite size of the signal, if we want to keep the block-size reasonable we are hence limited to values of of several dozens. Hence in practice we do not quite saturate the threshold , but exact reconstruction is possible very close to it, as illustrated in Fig. 2 in the main text, where the values that we used for the coupling parameters are listed in Table 1.
In Fig. 3, we also presented the result of the s-BP reconstruction of the Gaussian signal of density for different values of . We have observed empirically that the result is rather robust to choices of and . In this case, in order to demonstrate that very different choices give seeding matrices which are efficient, we used , and then and for , and for , and for and and for . One sees that a common aspect to all these choices is a large ratio . Empirically, this seems to be important in order to ensure a short convergence time. A more detailed study of convergence time of the dynamical system will be necessary in order to give some more systematic rules for choosing the couplings. This is left for future work.
Even though our theoretical study of the seeded BP was performed on an example of a specific signal distribution, the examples presented in Figs. 1 and 2 show that the performance of the algorithm is robust and also applies to images which are not drawn from that signal distribution.
Appendix F Phase diagram in the variables used by Donoho & Tanner (2005)
We show in Fig. 7 the phase diagram in the convention used by Donoho & Tanner (2005), which might be more convenient for some readers.
Appendix G Details on the phantom and Lena examples
In this section, we give a detailed description of the way we have produced the two examples of reconstruction in Fig. 1. It is important to stress that this figure is intended to be an illustration of the s-BP reconstruction algorithm. As such, we have used elementary protocols to produce true -sparse signals and have not tried to optimize the sparsity nor to use the best possible compression algorithm; instead, we have limited ourselves to the simplest Haar wavelet transform, to make the exact reconstruction and the comparison between the different approaches more transparent.
The Shepp-Logan example is a picture that has been generated using the Matlab implementation. The Lena picture is a crop of the gray version of the standard test image. In the first case, we have worked with the sparse one-step Haar transform of the picture, while in the second one, we have worked with a modified picture where we have kept the percent of largest (in absolute value) coefficients of the two-step Haar transform, while putting all others to zero. The datasets of the two images are available online noteASPICS (7). Compressed sensing here is done as follows: The original image is a vector o of pixels. The unknown vector are the projections of the original image on a basis of one- or two-steps Haar wavelets. It is sparse by construction. We generate a matrix F as described above, and construct . The measurements are obtained by , and the linear system for which one does reconstruction is . Once x has been found, the original image is obtained from . We used EM-BP and s-BP with a Gauss-Bernoulli .
Appendix H Performance of the algorithm in the presence of measurement noise
A systematic study of our algorithm for the case of noisy measurements can be performed using the replica analysis, but goes beyond the scope of the present work. In this section we however want to point out two important facts: 1) the modification of our algorithm to take into account the noise is straightforward, 2) the results that we have obtained are robust to the presence of a small amount of noise. As shown in section B, the probability of x after the measurement of y is given by
is the variance of the Gaussian noise in measurement . For simplicity, we consider that the noise is homogeneous, i.e., , for all , and discuss the result in unit of standard deviation . The AMP-form of the message passing including noise have already been given in section C. The variance of the noise, , can also be learned via expectation maximization approach, which reads: