423
Model Based Image Processing Charles A. Bouman

Model Based Image Processing (Text)

  • Upload
    lemien

  • View
    255

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Model Based Image Processing (Text)

Model Based Image Processing

Charles A. Bouman

Page 2: Model Based Image Processing (Text)

ii

Model Based ImagingCharles A. Bouman

Purdue University

Copyright c©2013 by Charles A. Bouman

All rights reserved.

Coverart through the gracious courtesy of

Prof. Andrew Davidhazy (.ret)

School of Photo Arts and Sciences

Rochester Institute of Technology

web: www.andpph.com

Page 3: Model Based Image Processing (Text)

To my family for their patient support

Page 4: Model Based Image Processing (Text)

iv

Page 5: Model Based Image Processing (Text)

Contents

1 Introduction 1

1.1 What is Model-Based Image Processing? . . . . . . . . . . . . 2

1.2 How can I learn Model-Based Image Processing? . . . . . . . . 8

2 Probability, Estimation, and Random Processes 13

2.1 Random Variables and Expectation . . . . . . . . . . . . . . . 13

2.2 Some Commonly Used Distributions . . . . . . . . . . . . . . 18

2.3 Frequentist and Bayesian Estimators . . . . . . . . . . . . . . 23

2.3.1 Frequentist Estimation and the ML Estimator . . . . . 23

2.3.2 Bayesian Estimation and the MAP Estimator . . . . . 27

2.3.3 Comparison of the ML and MMSE Estimators . . . . . 34

2.4 Discrete-Time Random Processes . . . . . . . . . . . . . . . . 35

2.5 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 41

3 Causal Gaussian Models 45

3.1 Causal Prediction in Gaussian Models . . . . . . . . . . . . . 45

3.2 Density Functions Based on Causal Prediction . . . . . . . . . 48

3.3 1-D Gaussian Autoregressive (AR) Models . . . . . . . . . . . 49

3.4 2-D Gaussian AR Models . . . . . . . . . . . . . . . . . . . . . 54

3.5 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 59

4 Non-Causal Gaussian Models 65

4.1 Non-Causal Prediction in Gaussian Models . . . . . . . . . . . 66

4.2 Density Functions Based on Non-Causal Prediction . . . . . . 67

Page 6: Model Based Image Processing (Text)

vi CONTENTS

4.3 1-D Gaussian Markov Random Fields (GMRF) . . . . . . . . 69

4.4 2-D Gaussian Markov Random Fields (GMRF) . . . . . . . . 72

4.5 Relation Between GMRF and Gaussian AR Models . . . . . . 73

4.6 GMRF Models on General Lattices . . . . . . . . . . . . . . . 77

4.7 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 80

5 MAP Estimation with Gaussian Priors 83

5.1 MAP Image Restoration . . . . . . . . . . . . . . . . . . . . . 84

5.2 Computing the MAP Estimate . . . . . . . . . . . . . . . . . . 88

5.3 Gradient Descent Optimization . . . . . . . . . . . . . . . . . 89

5.3.1 Convergence Analysis of Gradient Descent . . . . . . . 90

5.3.2 Frequency Analysis of Gradient Descent . . . . . . . . 93

5.3.3 Gradient Descent with Line Search . . . . . . . . . . . 96

5.4 Iterative Coordinate Descent Optimization . . . . . . . . . . . 97

5.4.1 Convergence Analysis of Iterative Coordinate Descent . 100

5.5 Conjugate Gradient Optimization . . . . . . . . . . . . . . . . 103

5.6 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 105

6 Non-Gaussian MRF Models 109

6.1 Continuous MRFs Based on Pair-Wise Cliques . . . . . . . . . 109

6.2 Selection of Potential and Influence Functions . . . . . . . . . 114

6.3 Convex Potential Functions . . . . . . . . . . . . . . . . . . . 117

6.4 Scaling Parameters for Non-Gaussian MRFs . . . . . . . . . . 123

6.5 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 127

7 MAP Estimation with Non-Gaussian Priors 129

7.1 The MAP Cost Function and Its Properties . . . . . . . . . . 129

7.2 General Approaches to Optimization . . . . . . . . . . . . . . 133

7.3 Optimization of the MAP Cost Function . . . . . . . . . . . . 138

7.4 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 143

Page 7: Model Based Image Processing (Text)

CONTENTS vii

8 Surrogate Functions and Majorization 145

8.1 Motivation and Intuition . . . . . . . . . . . . . . . . . . . . . 146

8.2 Formal Definition and Properties . . . . . . . . . . . . . . . . 147

8.3 Minimizing the MAP Cost Function . . . . . . . . . . . . . . . 150

8.4 Application to Line Search . . . . . . . . . . . . . . . . . . . . 157

8.5 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 161

9 Constrained Optimization 163

9.1 Motivation and Intuition . . . . . . . . . . . . . . . . . . . . . 163

9.2 The Lagrangian and Dual Function . . . . . . . . . . . . . . . 168

9.2.1 Strong Duality . . . . . . . . . . . . . . . . . . . . . . 171

9.2.2 Technical Conditions for Strong Duality . . . . . . . . 172

9.3 The Augmented Lagrangian . . . . . . . . . . . . . . . . . . . 175

9.4 Shrinkage and Proximal Mappings . . . . . . . . . . . . . . . . 180

9.5 Variable Splitting and the ADMM Algorithm . . . . . . . . . 185

9.5.1 Total Variation Regularization using ADMM . . . . . . 188

9.5.2 Enforcing Convex Constraints using ADMM . . . . . . 190

9.5.3 Convergence of ADMM Algorithm . . . . . . . . . . . 191

9.6 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 195

10 Model Parameter Estimation 199

10.1 Parameter Estimation Framework . . . . . . . . . . . . . . . . 199

10.2 Noise Variance Estimation . . . . . . . . . . . . . . . . . . . . 201

10.3 Scale Parameter Selection and Estimation . . . . . . . . . . . 204

10.4 Order Identification and Model Selection . . . . . . . . . . . . 208

10.5 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 209

11 The Expectation-Maximization (EM) Algorithm 211

11.1 Motivation and Intuition . . . . . . . . . . . . . . . . . . . . . 213

11.2 Gaussian Mixture Distributions . . . . . . . . . . . . . . . . . 215

11.3 Theoretical Foundation of the EM Algorithm . . . . . . . . . . 217

Page 8: Model Based Image Processing (Text)

viii CONTENTS

11.4 EM for Gaussian Mixtures . . . . . . . . . . . . . . . . . . . . 220

11.5 Algorithmic Implementation of EM Clustering . . . . . . . . . 222

11.6 EM Convergence and Majorization . . . . . . . . . . . . . . . 224

11.7 Simplified Methods for Deriving EM Updates . . . . . . . . . 226

11.7.1 Exponential Distributions and Sufficient Statistics . . . 226

11.7.2 EM for Exponential Distributions . . . . . . . . . . . . 232

11.7.3 EM for Multivariate Gaussian Mixtures . . . . . . . . . 233

11.8 ***Cluster Order Selection . . . . . . . . . . . . . . . . . . . . 234

11.9 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 235

12 Markov Chains and Hidden Markov Models 239

12.1 Markov Chains . . . . . . . . . . . . . . . . . . . . . . . . . . 239

12.2 Parameter Estimation for Markov Chains . . . . . . . . . . . . 242

12.3 Hidden Markov Models . . . . . . . . . . . . . . . . . . . . . . 244

12.3.1 State Sequence Estimation and Dynamic Programming 245

12.3.2 State Probability and the Forward-Backward Algorithm 247

12.3.3 Training HMMs with the EM Algorithm . . . . . . . . 249

12.4 Stationary Distributions of Markov Chains . . . . . . . . . . . 252

12.5 Properties of Markov Chains . . . . . . . . . . . . . . . . . . . 257

12.6 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 262

13 General MRF Models 265

13.1 MRFs and Gibbs Distributions . . . . . . . . . . . . . . . . . 266

13.2 1-D MRFs and Markov Chains . . . . . . . . . . . . . . . . . 271

13.3 Discrete MRFs and the Ising Model . . . . . . . . . . . . . . . 275

13.4 2-D Markov Chains and MRFs . . . . . . . . . . . . . . . . . 286

13.5 MRF Parameter Estimation . . . . . . . . . . . . . . . . . . . 290

13.6 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 294

14 Stochastic Simulation 297

14.1 Motivation for Simulation Methods . . . . . . . . . . . . . . . 297

Page 9: Model Based Image Processing (Text)

CONTENTS ix

14.2 The Metropolis Sampler . . . . . . . . . . . . . . . . . . . . . 299

14.3 The Hastings-Metropolis Sampler . . . . . . . . . . . . . . . . 304

14.4 Stochastic Sampling of MRFs . . . . . . . . . . . . . . . . . . 309

14.5 The Gibbs Sampler . . . . . . . . . . . . . . . . . . . . . . . . 313

14.6 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 317

15 Bayesian Segmentation 319

15.1 Framework for Bayesian Segmentation . . . . . . . . . . . . . 319

15.1.1 Discrete Optimization for MAP Segmentation . . . . . 323

15.1.2 Stochastic Integration for MPM Segmentation . . . . . 330

15.1.3 Multiscale Approaches to MAP Segmentation . . . . . 332

15.2 Joint Segmentation and Reconstruction . . . . . . . . . . . . . 336

15.3 ML Parameter Estimation with Stochastic EM . . . . . . . . . 341

15.4 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 349

16 Modeling Poisson Data 351

16.1 The Poisson Forward Model . . . . . . . . . . . . . . . . . . . 352

16.2 ICD Optimization with Surrogate Functions . . . . . . . . . . 358

16.3 Poisson Surrogate Based on EM Algorithm . . . . . . . . . . . 367

16.4 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 373

17 Advanced Models 375

17.1 Tomographic Forward Models . . . . . . . . . . . . . . . . . . 375

17.2 Advanced Prior Models . . . . . . . . . . . . . . . . . . . . . . 375

17.3 Sparse Linear Basis Models . . . . . . . . . . . . . . . . . . . 375

17.4 Dictionary Prior Models . . . . . . . . . . . . . . . . . . . . . 375

17.5 Chapter Problems . . . . . . . . . . . . . . . . . . . . . . . . . 376

A A Review of Convexity in Optimization 377

A.1 Appendix Problems . . . . . . . . . . . . . . . . . . . . . . . . 386

B The Boltzmann and Gibbs Distributions 387

Page 10: Model Based Image Processing (Text)

x CONTENTS

B.1 Derivation of Thermodynamic Relations . . . . . . . . . . . . 389

C Proofs of Poisson Surrogates 391

D Notation 395

Page 11: Model Based Image Processing (Text)

Chapter 1

Introduction

With a quick glance of the front cover, anyone with normal vision can tellyou what has happened. Something has fallen into a liquid, perhaps water,and caused a very symmetric and beautiful splash.

What seems like such a simple and natural response hides an enormouslysophisticated process that is able to infer from a 2-D light field a very complexseries of embedded phenomena. From the 2-D light field, we infer the 3-Dscene structure; from the scene structure, we infer the context of a fluidflowing through space and propagating as a wave; and from the dynamicmotion, we infer a cause, presumably a falling object of some kind that createda splash.

In fact, no one fully understands how humans solve such complex prob-lems, and we are unlikely to have complete answers in our lifetime, but theexample makes some things clear. First, such inverse problems represent afundamentally unsolved class of problems that are of enormous importance.Second, humans can only solve these problems by using strong embeddedknowledge of the physical world and the constraints it imposes on physicalobservations.

The following chapter lays out the philosophy that motivates the creationof model-based image processing as a discipline, and it explains how thestructure and content of this book can help to teach the basic tools neededto practically solve this important class of problems.

Page 12: Model Based Image Processing (Text)

2 Introduction

1.1 What is Model-Based Image Processing?

The goal of this book is to introduce the basic analytical tools for solving abroad range of inverse problems using the methods of model-based imageprocessing. Model-based image processing is a collection of techniques thathave emerged over the past few decades that provide a systematic frameworkfor the solution of inverse problems that arise in imaging applications.

Figure 1.1: Many imaging problems require the solution of an inverse problem inwhich the objective is to recover an unknown image X from measurements Y . Oftenthere are additional unknown “nuisance” parameters denoted by φ and θ that deter-mine characteristics of the physical system and the regularity conditions, respectively.

Figure 1.1 illustrates the general form of most inverse problems.1 A phys-ical system of some type provides measurements, Y , that depend on an un-known signal or image, X. The objective is then to determine the unknownsignal or image, X, from these measurements. Since X is not directly ob-served, this problem of determining X from Y is known as an inverse problembecause it requires that the physical process that generated the measurementsbe inverted or reversed to create X from Y .

Inverse problems occur often in real imaging systems. So for example,Y might represent the measurements of a volume X taken by an opticalor electron microscope, or it might represent the voltages read-outs in theCMOS sensor of a cell-phone camera. Alternatively, Y might represent themeasurements from a radio telescope of unknown astronomical structures, orthe photon counts in a medical PET scanner. All these imaging systems, andmany more, share this same unifying structure.

1A second kind of inverse problem often occurs in which it is necessary to determine the input to a systemthat produces a desired output.

Page 13: Model Based Image Processing (Text)

1.1 What is Model-Based Image Processing? 3

Any algorithm used for computing the solution to an inverse problem willtypically share certain common structures or components. So for example,the purpose of any inversion algorithm is to produce an estimate, X, of theunknown image, X, from the observations, Y . Often, there are also unknownnuisance parameters of the system that we denote by φ. These parameterscan represent unknown calibration parameters, such as focus or noise gain,that are typically not of direct interest, but must be determined to solve theinversion problem. Other parameters, θ, are needed to determine the amountof regularization or smoothing required in the inversion process.

The model-based approach is built on a foundation of probability, so boththe physical system and image to be discovered, X, are modeled as randomquantities. The so-called forward model of the system is embodied byp(y|x), the conditional distribution of the data, Y , given the unknown image,X. The prior model of the unknown image is embodied by the assumedprior distribution, p(x). Intuitively, p(y|x) tells us everything about how theobservations are related to the unknown. This includes both the deterministicproperties of the imaging system, such as its geometry and sensitivity, as wellas probabilistic properties such as the noise amplitude.

Figure 1.2 illustrates the typical approach to model-based inversion. Thekey idea is to first create a forward model of the physical imaging system,and then search for an input, X, to the forward model that best matchesthe actual measurements. This is often a counter-intuitive approach since westart the process of computing an inverse by computing the forward model,rather than directly looking for an inverse to the measurements. However,an advantage of this approach is that we can in principle invert any systemthat we can model. So the same approach is applicable to nonlinear systemsor other systems for which there is no obvious analytical inverse.

Another critically important ingredient to model-based inversion is theuse of a prior model to characterize the likely behavior of real images. Ourgoal will be to compute a final estimate, X, that represents a balance be-tween fitting the system model, p(y|x), and remaining consistent with theexpectations of the prior model, p(x). In this text, we will primarily use thetools of Bayesian inference as a general framework for balancing these twoobjectives. While other approaches can be used and may have advantagesin particular situations, the Bayesian approach is an intuitive and practical

Page 14: Model Based Image Processing (Text)

4 Introduction

Figure 1.2: Graphical illustration of how model-based methods are typically used tosolve inverse problems in imaging applications. The measurements Y of a physicalsystem depend on an unknown imageX. In addition, there are often unknown system-model parameters, φ, and prior-model parameters, θ. Model-based inversion worksby searching for an input x that matches the measured output y, but also balancesthe need for the solution to be consistent with a prior model of the data.

approach that naturally blends both prior and measured information.

Often the concept of a prior model is discomforting to people, particularlythose who are in the habit of using formal physical models of sensing systems.A typical request is to “make no assumptions” about the result. However, inpractice, it is never possible to make “no assumptions”. All inverse algorithmshave built-in assumptions about the smoothness or resolution of the result.Usually, these assumptions are implicitly enforced through the choice of amaximum image resolution or the selection of a reconstruction filter. Sothe uncomfortable truth is that since it is always necessary to enforce someassumptions about the image being recovered, X, then it is best to select themost accurate model, p(x), so as to introduce the least onerous distortionsin the recovered image, X.

Figure 1.3 graphically illustrates an intuitive argument for why model-based methods can dramatically improve the estimation of images from data.Obviously, an image formed by independent white noise has no chance oflooking like a real natural image. But from a probabilistic perspective, thereis a very, very small probability that a white noise image could appear to bethe Mona Lisa, the famous painting of Leonardo da Vinci. Perhaps this is thevisual parallel to the argument that a monkey randomly hitting the keys of a

Page 15: Model Based Image Processing (Text)

1.1 What is Model-Based Image Processing? 5

Figure 1.3: Graphical illustration of how forward and prior models can interact syn-ergistically to dramatically improve results. The green curve represents the thinmanifold in which real images lie, and the gray line represents the thin manifolddefined by noisy linear measurements. If the number of measurements, M , is lessthan the number of unknowns, N , then classical methods admit no unique solution.However, in this case model-based approaches can still provide a useful and uniquesolution at the intersection of the measurement and prior manifolds.

typewriter would eventually (almost surely in fact) produce Hamlet. Whilethis may be true, we know that from a practical perspective any given white-noise image (or random sequence typed by a monkey) is much more likelyto appear to be incoherent noise than a great work of art. This argumentmotivates the belief that real natural images have a great deal of structurethat can be usefully exploited when solving inverse problems.

In fact, it can be argued that real natural images fall on thin manifolds intheir embedded space. Such a thin image manifold is illustrated graphicallyin Figure 1.3 as a blurry green curve. So if X ∈ [0, 1]N is an image withN pixels each of which fall in the interval Xs ∈ [0, 1], then with very highprobability, X will fall within a very small fraction of the space in [0, 1]N .Alternatively, a random sample from [0, 1]N will with virtual certainty neverlook like a natural image. It will simply look like noise.

In order to see that a natural images lives on a thin manifold, consider animage with one missing pixel, Xs. Then the conditional distribution of that

Page 16: Model Based Image Processing (Text)

6 Introduction

pixel given the rest of the image is p(xs|xr r 6= s). In practice, a single missingpixel from a natural image can almost always be predicted with very highcertainty. Say for example, that µs = E[xs|xr r 6= s] is the conditional meanof Xs and σs = Std[xs|xr r 6= s] is the conditional standard deviation. Thenthe “thickness” the manifold at the location Xr r 6= s is approximately σs.Since Xs can be predicted with high certainty, we know that σs << 1, and themanifold is thin at that point. This in turn proves that a manifold containingreal images, as illustrated in green, is thin in most places. However, whileit is thin, it does in fact have some small thickness because we can almostnever predict the missing pixel with absolute certainty. The situation isillustrated in Figure 1.3 for the case of a 2-D “image” formed by only twopixels X = [X1, X2].

Measurements typically constrain the solutions of an inverse problem to lieon a manifold that is, of course, data dependent. If the measurement is linear,then this thin measurement manifold is approximately a linear manifold (i.e.,an affine subspace) except it retains some thickness due to the uncertaintyintroduced by measurement noise. So let Y = AX + W , where Y is an M

dimensional column vector of measurements, W is the measurement noise,and A is anM×N matrix. Then each row of A represents a vector, illustratedby the red vectors of Figure 1.3, that projects X onto a measurement space.The resulting thin measurement manifold shown in gray is orthogonal to thisprojection, and its thickness is determined by the uncertainty due to noise inthe measurement.

If the number of measurements, M , is less than the dimension of the image,N , then it would seem that the inverse problem can not be meaningfullysolved because the solution can lie anywhere on the thin manifold definedby the measurement. In this situation, the prior information is absolutelyessential because it effectively reduces the dimensionality of the unknown, X.Figure 1.3 shows that even when the number of measurements is less thanthe number of unknowns, a good solution can be found at the intersection ofthe measurement and prior manifolds. This is why model-based methods canbe so powerful in real problems. They allow one to solve inverse problemsthat otherwise would have no solution.2

2Of course, other methods, most notably regularized inversion, have existed for a long time that allow forthe solution of so-called ill-posed inverse problems. In fact, we include these approaches under the umbrellaof model-based methods, but note that model-based methods typically emphasize the use of probabilisticmodels that are designed to accurately characterize the system and unknown image.

Page 17: Model Based Image Processing (Text)

1.1 What is Model-Based Image Processing? 7

Figure 1.4: The tradeoff between bias and variance is at the core of model-based imageprocessing. Variance typically represents noise in the an image, and bias typicallyrepresent excessive smoothing or blur. In many problems, the variance can becomelarge or even infinite if the bias is driven to zero. In practice, this means it is notpossible to estimate a solution with infinite resolution using a finite amount of data.

Nonetheless, there is a price to be paid for using model-based methods.First, model-based methods require the creation of accurate models of boththe measurement system and the images, X, being recovered. This is often adifficult and time consuming task. Second, the incorporation of a prior modelnecessarily introduces bias into the recovery of X. Figure 1.4 conceptuallyrepresents the key tradeoff of variance versus bias that is at the heart ofmodel-based approaches. When a researcher asks for a solution that makesno assumptions, they are implicitly asking for a solution with no bias inthe estimate of X. However, estimators that achieve this goal often do itat the price of very large, or perhaps even infinite, variance in the finalestimate. Roughly speaking, variance in the estimate can be viewed as noise,and bias can be viewed as systematic changes that would occur over manyestimates whose noise was averaged away. So typical examples of bias arereconstruction error due to blur and other forms of excessive smoothing, orsystematic artifacts such as streaks or offsets.

Page 18: Model Based Image Processing (Text)

8 Introduction

Figure 1.4 graphically illustrates the tradeoff between variance and bias asa convex curve.3 As the bias is reduced, the variance must increase. The bestsolution depends on the specific application, but, for example, the minimummean squared error solution occurs at the interaction of the red curve witha line of slope -1.

The example of Figure 1.4 illustrates a case where the variance can goto infinity as the bias goes to zero. In this case, a prior model is essentialto achieving any useful solution. However, the prior model also introducessome systematic bias in the result; so the crucial idea is to use a prior modelthat minimizes any bias that is introduced. Traditional models that assume,for example, that images are band limited, are not the best models of realimages in most applications, so they result in suboptimal results, such as theone illustrated with a star. These solutions are suboptimal because at a fixedbias, there exists a solution with less variance, and at a fixed variance, thereexists a solution with lower bias.

Figure 1.5 shows the practical value of model-based methods [64]. Thisresult compares state-of-the-art direct reconstruction results and model-basediterative reconstruction (MBIR) applied to data obtained from a GeneralElectric 64 slice Volumetric Computed Tomography (VCT) scanner. Thedramatic reduction in noise could not simply be obtained by post-processingof the image. The increased resolution and reduced noise is the result of thesynergistic interaction between the measured data and the prior model.

1.2 How can I learn Model-Based Image Processing?

The remainder of this book presents the key mathematical and probabilistictechniques and theories that comprise model-based image processing. Per-haps the two most critical components are models of both systems and im-ages, and estimators of X based on those models. In particular, accurateimage models are an essential component of model-based image processingdue to the need to accurately model the thin manifold on which real imageslive.

Importantly, real images are not accurately modeled by Gaussian distri-

3It can be proved that the optimal curve must be convex by randomizing the choice of any two algorithmsalong the curve.

Page 19: Model Based Image Processing (Text)

1.2 How can I learn Model-Based Image Processing? 9

Figure 1.5: Comparison of state-of-the-art direct methods on the left to model-basediterative reconstruction (MBIR) on the right for the 3-D reconstruction of a medicalimage from data collected from a General Electric 64 slice Volumetric ComputedTomography (VCT) scanner. Notice that by using a accurate model of both thescanner and the image being reconstructed, it is possible to recover fine detail of theanatomy while simultaneously reducing noise.

butions. In fact, a histogram of the difference between adjacent pixel pairs injust about any natural image will clearly show a Laplacian distribution. Intu-itively, the sharp edges in natural images caused by occlusion create statisticsthat are very non-Gaussian. Referring back to Figure 1.3, notice that the thinimage manifold is represented as being curved. This nonlinear manifold is adirect result of the non-Gaussian nature of real images.

Another crucial requirement for image models is that they capture thenon-causal nature of image structure. Most 1-D signals, such as audio orradio signals, can be modeled using causal structure. However, causal modelsbreak down in 2-D because they can no longer capture the naturally occurringcharacteristics of images. Unfortunately, we will see that in two or moredimensions non-casual models introduce very profound technical problems.This is because non-causal graphs in more than one dimension typically haveloops, and these loops fundamentally break many of the algorithms and toolsof 1-D signal processing. Consequently, a major theme of this book will be

Page 20: Model Based Image Processing (Text)

10 Introduction

to explain and understand the methods of Markov random fields, the centraltool for the non-causal modeling of images and signals that live on 2-D latticesand loopy graphs.

1-D Models 2-D Models

GaussianCausal AR (Sec. 3.3) 2-D AR (Sec. 3.4)Non-Causal 1-D GMRF (Sec. 4.3) 2-D GMRF (Sec. 4.4)

non-GaussianCausal Markov Process 2-D Markov ProcessNon-Causal 1-D MRF (Chap. 6) 2-D MRF (Chap. 6)

DiscreteCausal Markov Chain (Sec. 12.1) 2-D Markov ChainNon-Causal 1-D MRF (Chap. 13) 2-D MRF (Chap. 13)

Table 1.1: A table of typical properties or characteristics that are often assumed indata models. The first, and perhaps simplest model we discuss is the 1-D Gaussiancausal AR model of Section 3.3. From this first case, we generalize to include non-causal models in 2-D that take on both non-Gaussian and discrete values. The tablelists out a total of 12 possible cases, of which we will cover 9 of these cases in somedetail.

Table 1.1 lists out the various possible models, and shows the appropriatesections of the book where they are discussed. In fact, each topic representsa choice between three discrete categories: 1-D, 2-D, causal, non-causal,and Gaussian, non-Gaussian,Discrete. Of course, real images are best mod-eled as 2-D, non-causal, and non-Gaussian; but we start with the simplestcase of 1-D, causal, and Gaussian, and then work towards more complex mod-els through the book. Towards the end of the book, we delve into discretestate models that are particularly useful for inverse problems involving thesegmentation or classification of images.

Along the way, we introduce related theoretical and algorithmic techniquesthat are useful or even essential for solving model-based imaging applications.In particular, Chapters 5 and 7 present some of the basic methods of opti-mization in the context of model-based image processing. So the focus ofthis section is on understanding the advantages and disadvantages of differ-ent approaches, particularly when solving large problems.

Chapter 11 introduces the theory and practice of the EM algorithm, anessential tool in model-based image processing. The EM algorithm providesa general framework for estimating unknown model parameters when X isunknown. So for example, in Figures 1.1 and 1.2 the variables φ and θ denoteunknown parameters of the system and image, respectively. In some cases,these parameters can be determined in advanced, but in many cases they

Page 21: Model Based Image Processing (Text)

1.2 How can I learn Model-Based Image Processing? 11

must be estimated from the data Y as part of the inversion process. This iswhen the EM algorithm plays a critical role.

The final Chapters of 12 through 15 cover the basics of ergodic Markovchains and stochastic simulations. The techniques of stochastic simulationare particularly useful in applications such as image segmentation when Xis modeled as a discrete Markov random field. Stochastic simulation is alsoessential in the application of the EM algorithm when the so-called E-stepcan not be computed in closed form. This topic is covered in the section onstochastic EM.

Of course, all of this material depends on a solid understanding of thebasic techniques of probability and estimation, so Chapter 2 presents a quickbut comprehensive and hopefully truthful account of the essential conceptsalong with homework problems that reinforce the key ideas.

Page 22: Model Based Image Processing (Text)

12 Introduction

Page 23: Model Based Image Processing (Text)

Chapter 2

Probability, Estimation, and RandomProcesses

This chapter provides a quick review of probability, estimation, and randomprocesses. It also introduces many of the basic tools that will be needed formodeling physical data.

Two important themes throughout this book will be the use of both fre-quentist and Bayesian methods for the estimation of unknown quantities. InSection 2.3.1, the ubiquitous maximum likelihood (ML) estimator willbe presented as an important example of the frequentist approach; and inSection 2.3.2, the minimum mean squared error (MMSE) estimatorwill be used to illustrate the Bayesian approach. Our goal is to show thateach approach, frequentist or Bayesian, has its potential advantages, and thebest choice tends to depend on the particular situation. Generally, we willsee that the ML estimator tends to be a good choice when the ratio of theamount of data to the number of unknowns is much greater than 1, whereasthe MMSE estimator tends to be a good choice when this ratio approachesor is less than 1.

2.1 Random Variables and Expectation

Let X be a real valued random variable with cumulative distributionfunction (CDF) given by

F (t) , PX ≤ t

Page 24: Model Based Image Processing (Text)

14 Probability, Estimation, and Random Processes

where PX ≤ t is the probability of the event that X is less than or equalto t. In fact, F (t) is a valid CDF if and only if it has three properties:First, it must be a monotone increasing function of t; second, it must beright hand continuous; and third, must have limits of limt→∞ F (t) = 1 andlimt→−∞ F (t) = 0.

If F (t) is an absolutely continuous function, then it will have an associatedprobability density function (PDF), p(t), such that

F (t) =

∫ t

−∞p(τ)dτ .

For most physical problems, it is reasonable to assume that such a densityfunction exists, and when it does then it is given by

p(t) =dF (t)

dt.

Any function1 of a random variable is itself a random variable. So forexample, if we define the new random variable Y = g(X) where g : R → R,then Y will also be a random variable.

Armed with the random variable X and its distribution, we may definethe expectation as

E[X] ,

∫ ∞

−∞τdF (τ) =

∫ ∞

−∞τp(τ)dτ .

The first integral form is known as a Lebesgue-Stieltjes integral and isdefined even when the probability density does not exist. However, the secondintegral containing the density is perhaps more commonly used.

The expectation is a very basic and powerful tool which exists under verygeneral conditions.2 An important property of expectation, which directlyresults from its definition as an integral, is linearity.

Property 2.1. Linearity of expectation - For all random variables X and Y ,

E[X + Y ] = E[X] + E[Y ] .

1Technically, this can only be a Lebesgue-measurable function; but in practice, measurability is a reason-able assumption in any physically meaningful situation.

2 In fact, for any positive random variable, X, the E[X] takes on a well-defined value on the extendedreal line of (−∞,∞]. In addition, whenever E[|X|] < ∞, then E[X] is real valued and well-defined. So wewill generally assume that E[|X|] <∞ for all random variables we consider.

Page 25: Model Based Image Processing (Text)

2.1 Random Variables and Expectation 15

Of course, it is also possible to specify the distribution of groups of randomvariables. So let X1, · · · , Xn be n random variables. Then we may specifythe joint distribution of these n random variables via the n-dimensional CDFgiven by

F (t1, · · · , tn) = PX1 ≤ t1, · · · , Xn ≤ tn .In this case, there is typically an associated n-dimensional PDF, p(t1, · · · , tn),so that

F (t1, · · · , tn) =∫ t1

−∞· · ·∫ tn

−∞p(τ1, · · · , τn)dτ1 · · · dτn .

Again, any function of the vector X = (X1, · · · , Xn) is then a new randomvariable. So for example, if Y = g(X) where g : Rn → R, then Y is a randomvariable, and we may compute its expectation as

E[Y ] =

Rn

g(τ1, · · · , τn)p(τ1, · · · , τn)dτ1 · · · dτn .

If we have a finite set of random variables, X1, · · · , Xn, then we say therandom variables are jointly independent if we can factor the CDF (orequivalently the PDF if it exists) into a product with the form,

F (t1, · · · , tn) = Fx1(t1) · · ·Fxn

(tn) ,

where Fxk(tk) denotes the CDF for the random variable Xk. This leads to

another important property of expectation.

Property 2.2. Expectation of independent random variables - If X1, · · · , Xn

are a set of jointly independent random variables, then we have that

E

[

n∏

k=1

Xk

]

=n∏

k=1

E[Xk] .

So when random variables are jointly independent, then expectation andmultiplication can be interchanged. Perhaps surprisingly, pair-wise indepen-dence of random variables does not imply joint independence. (See problem 3)

One of the most subtle and important concepts in probability is condi-tional probability and conditional expectation. Let X and Y be two randomvariables with a joint CDF given by F (x, y) and marginal CDF given by

Page 26: Model Based Image Processing (Text)

16 Probability, Estimation, and Random Processes

Fy(y) = limx→∞ F (x, y) . The conditional CDF of X given Y = y is thenany function, F (x|y), which solves the equation

F (x, y) =

∫ y

−∞F (x|t)dFy(t) .

At least one solution to this equation is guaranteed to exist by an applicationof the famous Radon-Nikodym theorem.3 So the conditional CDF, F (x|y),is guaranteed to exist. However, this definition of the conditional CDF issomewhat unsatisfying because it does not specify how to construct F (x|y).

Fortunately, the conditional CDF can be calculated in most practical sit-uations as

F (x|y) = dF (x, y)

dy

(

dF (∞, y)

dy

)−1.

More typically, we will just work with probability density functions so that

p(x, y) =d2F (x, y)

dxdy

py(y) =dF (∞, y)

dy.

Then the PDF of X given Y = y is given by

p(x|y) = p(x, y)

py(y).

We may now ask what is the conditional expectation of X given Y ? Itwill turn out that the answer to this question has a subtle twist because Yis itself a random variable. Formally, the conditional expectation of X givenY is given by4

E[X|Y ] =

∫ ∞

−∞xdF (x|Y ) ,

or alternatively using the conditional PDF, it is given by

E[X|Y ] =

∫ ∞

−∞xp(x|Y )dx .

3 Interestingly, the solution is generally not unique, so there can be many such functions F (x|y). However,it can be shown that if F (x|y) and F ′(x|y) are two distinct solution, then the functions F (x|Y ) and F ′(x|Y )are almost surely equal.

4 In truth, this is an equality between two random variables that are almost surely equal.

Page 27: Model Based Image Processing (Text)

2.1 Random Variables and Expectation 17

Notice that in both cases, the integral expression for E[X|Y ] is a function ofthe random variable Y . This means that the conditional expectation is itselfa random variable!

The fact that the conditional expectation is a random variable is veryuseful. For example, consider the so-called indicator function denoted by

IA(X) ,

1 if X ∈ A0 otherwise

.

Using the indicator function, we may express the conditional probability ofan event, X ∈ A, given Y as

PX ∈ A|Y = E[IA(X)|Y ] . (2.1)

Conditional expectation also has many useful properties. We list somebelow.

Property 2.3. Filtration property of conditional expectation - For all randomvariables X, Y , and Z

E[E[X|Y, Z] |Y ] = E[X|Y ] .

A special case of the filtration property is that E[X] = E[E[X|Y ]]. Thiscan be a useful relationship because sometimes it is much easier to evaluatean expectation in two steps, by first computing E[X|Z] and then takingthe expectation over Z. Another special case of filtration occurs when weuse the relationship of equation (2.1) to express conditional expectations asconditional probabilities. In this case, we have that

E[P X ∈ A|Y, Z |Y ] = P X ∈ A|Y .

Again, this relationship can be very useful when trying to compute condi-tional expectations.

Property 2.4. Conditional expectation of known quantities - For all randomvariables X, Y , and Z, and for all functions f(·)

E[f(X)Z|X, Y ] = f(X)E[Z|X, Y ] ,

which implies that E[X|X, Y ] = X.

Page 28: Model Based Image Processing (Text)

18 Probability, Estimation, and Random Processes

This property states the obvious fact that if we are given knowledge ofX, then the value of f(X) is known. For example, if we are told that thetemperature outside is exactly 100 degrees Fahrenheit, then we know thatthe expectation of the outside temperature is 100 degrees Fahrenheit. Noticethat since E[X|Y ] = f(Y ) for some function f(·), Property 2.4 may be usedto show that

E[E[X|Y ] |Y, Z] = E[f(Y )|Y, Z]= f(Y )

= E[X|Y ] .

Therefore, we know that for all random variables, X, Y , and Z

E[E[X|Y, Z] |Y ] = E[X|Y ] = E[E[X|Y ] |Y, Z] . (2.2)

2.2 Some Commonly Used Distributions

Finally, we should introduce some common distributions and their associ-ated notation. A widely used distribution for a random variable, X, is theGaussian distribution denoted by

p(x) =1√2πσ2

exp

− 1

2σ2(x− µ)2

where µ ∈ R and σ2 > 0 are known as the mean and variance parametersof the Gaussian distribution, and it can be easily shown that

E[X] = µ

E[

(X − µ)2]

= σ2 .

We use the notation X ∼ N(µ, σ2) to indicate that X is a Gaussian randomvariable with mean µ and variance σ2.

A generalization of the Gaussian distribution is the multivariate Gaus-sian distribution. We can use vector-matrix notation to compactly repre-sent the distributions of multivariate Gaussian random vectors. Let X ∈ R

p

denote a p-dimensional random column vector, and X t denote its transpose.Then the PDF of X is given by

p(x) =1

(2π)p/2|R|−1/2 exp

−12(x− µ)tR−1(x− µ)

, (2.3)

Page 29: Model Based Image Processing (Text)

2.2 Some Commonly Used Distributions 19

where µ ∈ Rp is the mean vector and R ∈ R

p×p is the covariance matrixof the multivariate Gaussian distribution. Without loss of generality, thecovariance matrix can be assumed to be symmetric (i.e., R = Rt); however,in order to be a well defined distribution the covariance must also be positivedefinite, otherwise p(x) can not integrate to 1. More precisely, let 0 denotea column vector of 0’s. We say that a symmetric matrix is positive semi-definite if for all y ∈ R

p such that y 6= 0, then ||y||2R , ytRy ≥ 0. If theinequality is strict, then the matrix is said to be positive definite.

We will use the notation X ∼ N(µ,R) to indicate that X is a multivariateGaussian random vector with mean µ and positive-definite covariance R, andin this case it can be shown that

E[X] = µ

E[

(X − µ)(X − µ)t]

= R .

A random vector with the distribution of equation (2.3) is also known as ajointly Gaussian random vector.5 It is important to note that a vector ofGaussian random variables is not always jointly Gaussian. So for example, itis possible for each individual random variable to have a marginal distributionthat is Gaussian, but for the overall density not to have the form of (2.3).Furthermore, it can be shown that a random vector is jointly Gaussian, if andonly if any linear transformation of the vector produces Gaussian randomvariables. For example, it is possible to construct two Gaussian randomvariables, X1 and X2, such that each individual random variable is Gaussian,but the sum, Y = X1 +X2, is not. In this case, X1 and X2 are not jointlyGaussian.

An important property of symmetric matrices is that they can be diagonal-ized using an orthonormal transformation. So for example, if R is symmetricand positive definite, then

R = EΛEt

where E is an orthonomal matrix whose columns are the eigenvectors of Rand Λ is a diagonal matrix of strictly positive eigenvalues. Importantly, ifX is a zero-mean Gaussian random vector with covariance R, then we can

5 Furthermore, we say that a finite set of random vectors is jointly Gaussian if the concatenation of thesevectors forms a single vector that is jointly Gaussian.

Page 30: Model Based Image Processing (Text)

20 Probability, Estimation, and Random Processes

decorrelate the entries of the vector X with the transformation

X = EtX .

In this case, E[

XX t]

= Λ, so the components of the vector X are said to be

uncorrelated since then E

[

XiXj

]

= 0 for i 6= j. Moreover, it can be easily

proved that since X is jointly Gaussian with uncorrelated components, thenits components must be jointly independent.

Jointly Gaussian random variables have many useful properties, one ofwhich is listed below.

Property 2.5. Linearity of conditional expectation for Gaussian random vari-ables - If X ∈ R

n and Y ∈ Rp are jointly Gaussian random vectors, then

E[X|Y ] = AY + b

E[

(X − E[X|Y ])(X − E[X|Y ])t|Y]

= C ,

where A ∈ Rn×p is a matrix, b ∈ R

n is a vector, and C ∈ Rn×n is a positive-

definite matrix. Furthermore, if X and Y are zero mean, then b = 0 and theconditional expectation is a linear function of Y .

The Bernoulli distribution is an example of a discrete distributionwhich we will find very useful in image and signal modeling applications.If X has a Bernoulli distribution, then

PX = 1 = θ

PX = 0 = 1− θ ,

where θ ∈ [0, 1] parameterizes the distribution. Since X takes on discretevalues, its CDF has discontinuous jumps. The easiest solution to this problemis to represent the distribution with a probability mass function (PMF)rather than a probability density function. The PMF of a random variable orrandom vector specifies the actual probability of the random quantity takingon a specific value. If X has a Bernoulli distribution, then it is easy to showthat its PMF may be expressed in the more compact form

p(x) = (1− θ)1−xθx ,

where x ∈ 0, 1. Another equivalent and sometimes useful expression forthe PMF of a Bernoulli random variable is given by

p(x) = (1− θ)δ(x− 0) + θδ(x− 1) ,

Page 31: Model Based Image Processing (Text)

2.2 Some Commonly Used Distributions 21

where the function δ(x) is 1 when its argument is 0, and 0 otherwise.

Regardless of the specific choice of distribution, it is often the case thata series of n experiments are performed with each experiment resulting inan independent measurement from the same distribution. In this case, wemight have a set of jointly independent random variables, X1, · · · , Xn, whichare independent and identically distributed (i.i.d.). So for example,if the random variables are i.i.d. Gaussian with distribution N(µ, σ2), thentheir joint distribution is given by

p(x) = p(x1, · · · , xn) =(

1

2πσ2

)n/2

exp

− 1

2σ2

n∑

k=1

(xk − µ)2

.

Notice that for notational simplicity, x is used to denote the entire vector ofmeasurements.

Example 2.1. Let X1, · · · , Xn be n i.i.d. Gaussian random vectors each withmultivariate Gaussian distribution given by N(µ,R), where µ ∈ R

p and R ∈R

p×Rp. We would like to know the density function for the entire observation.In order to simplify notation, we will represent the data as a matrix

X = [X1, · · · , Xn] .

Since the n observations, X1, · · · , Xn, are i.i.d., we know we can represent thedensity of X as the following product of densities for each vector Xk.

p(x) =n∏

k=1

1

(2π)p/2|R|−1/2 exp

−12(xk − µ)tR−1(xk − µ)

=1

(2π)np/2|R|−n/2 exp

−12

n∑

k=1

(xk − µ)tR−1(xk − µ)

This expression may be further simplified by defining the following two newsample statistics,

b =n∑

k=1

xk = x1 (2.4)

S =n∑

k=1

xkxtk = xxt , (2.5)

Page 32: Model Based Image Processing (Text)

22 Probability, Estimation, and Random Processes

where 1 is an n dimensional column vector of 1′s, and xxt is the product ofthe matrix x with its transpose. In general, a statistic is any function ofthe observed data, but typically, statistics summarize the data in some usefulway. Using these two statistics, the PDF of X may be written as

p(x) =1

(2π)np/2|R|−n/2 exp

−12tr

SR−1

+ btR−1µ− n

2µtR−1µ

, (2.6)

where trA denotes the trace of the matrix A. In fact, this expression easilyresults by applying the very useful property that

trAB = trBA , (2.7)

for any two matrices A ∈ Rm×n and B ∈ R

n×m. (See problem 12)

If we define the combined statistic T = (b, S) from equations (2.4) and(2.5), then T is said to be a sufficient statistic for the family of multi-variate Gaussian distributions parameterized by θ = (µ,R). More precisely,a sufficient statistic, T , is a statistic with the property that the associateddistribution can be written in the form

p(x|θ) = h(x)g(T (x), θ) ,

for some functions h(·) and g(·, ·). (See Section 11.7.1 for more details.)Intuitively, a sufficient statistic for a distribution contains all the informationthat is necessary to estimate an unknown parameter θ.

Example 2.2. Let X1, · · · , Xn be n i.i.d. Bernoulli random variables, each withparameter θ. We would like to know the probability mass function for theentire observation. Again, since the n observations are i.i.d., we know thatthe PMF is given by

p(x) =n∏

k=1

(1− θ)1−xkθxk

= (1− θ)n−N1θN1

where N1 =∑n

k=1 xk is a sufficient statistic which counts the number ofrandom variables Xk that are equal to 1.

Page 33: Model Based Image Processing (Text)

2.3 Frequentist and Bayesian Estimators 23

2.3 Frequentist and Bayesian Estimators

Once we have decided on a model, our next step is often to estimate someinformation from the observed data. There are two general frameworks forestimating unknown information from data. We will refer to these two generalframeworks as the Frequentist and Bayesian approaches. We will see thateach approach is valuable, and the key is understanding what combination ofapproaches is best for a particular application.

The following subsections present each of the two approaches, and thenprovide some insight into the strengths and weaknesses of each approach.

2.3.1 Frequentist Estimation and the ML Estimator

In the frequentist approach, one treats the unknown quantity as a determin-istic, but unknown parameter vector, θ ∈ Ω. So for example, after we observethe random vector Y ∈ R

p, then our objective is to use Y to estimate the un-known scalar or vector θ. In order to formulate this problem, we will assumethat the vector Y has a PDF given by pθ(y) where θ parameterizes a familyof density functions for Y . We may then use this family of distributions todetermine a function, T : Rn → Ω, that can be used to compute an estimateof the unknown parameter as

θ = T (Y ) .

Notice, that since T (Y ) is a function of the random vector Y , the estimate,θ, is a random vector. The mean of the estimator, θ, can be computed as

θ = Eθ

[

θ]

= Eθ[T (Y )] =

Rn

T (y)pθ(y)dy .

The difference between the mean of the estimator and the value of the pa-rameter is known as the bias and is given by

biasθ = θ − θ .

Similarly, the variance of the estimator is given by

varθ = Eθ

[

(

θ − θ)2]

,

Page 34: Model Based Image Processing (Text)

24 Probability, Estimation, and Random Processes

and it is easily shown that the mean squared error (MSE) of the estimateis then given by

MSEθ = Eθ

[

(

θ − θ)2]

= varθ + (biasθ)2 .

Since the bias, variance, and MSE of the estimator will depend on thespecific value of θ, it is often unclear precisely how to compare the accuracyof different estimators. Even estimators that seem quite poor may producesmall or zero error for certain values of θ. For example, consider the estimatorwhich is fixed to the value θ = 1, independent of the data. This would seemto be a very poor estimator, but it has an MSE of 0 when θ = 1.

Many important properties of a estimator depend on its behavior as theamount of observed data tends toward infinity. So, imagine that we have aseries of n independent observations denoted by Y = (Y1, · · · , Yn), and letθn(Y ) be an estimate of the parameter θ that uses all n samples. We say thatthe estimate θn is consistent if it converges to the true value in probabilityas n goes to infinity.6 If an estimator is not consistent, this means that evenwith arbitrarily large quantities of data, the estimate is not guarranteed toapproach the true value of the parameter. Consistency would seem to be theleast we would expect of an estimator, but we will later see that even somevery intuitive estimators are not always consistent.

Ideally, it would be best if one could select an estimator which has uni-formly low bias and/or variance for all values of θ. This is not always possible,but when it is we have names for such estimators. For example, θ is said tobe an unbiased estimator if for all values of θ the bias is zero, i.e. θ = θ.If in addition, for all values of θ, the variance of an estimator is less than orequal to that of all other unbiased estimators, then we say that the estimatoris a uniformly minimum variance unbiased (UMVU) estimator.

There are many excellent estimators that have been proposed throughthe years for many different types of problems. However, one very widelyused Frequentist estimator is known as the maximum likelihood (ML)estimator given by

θ = argmaxθ∈Ω

pθ(Y )

6 Formally stated, if θn is an estimate of the parameter θ based on n independent samples, Y1, · · · , Yn, thenwe say the estimator is consistent if for all θ ∈ Ω and for all ǫ > 0, we know that limn→∞ Pθ|θ− θ| > ǫ = 0.

Page 35: Model Based Image Processing (Text)

2.3 Frequentist and Bayesian Estimators 25

= argmaxθ∈Ω

log pθ(Y ) .

where the notation “argmax” denotes the value of the argument that achievesthe global maximum of the function. Notice that these formulas for the MLestimate actually use the random variable Y as an argument to the densityfunction pθ(y). This implies that θ is a function of Y , which in turn meansthat θ is a random variable.

When the density function, pθ(y), is a continuously differentiable functionof θ, then a necessary condition when computing the ML estimate is that thegradient of the likelihood is zero.

∇θ pθ(Y )|θ=θ = 0 .

While the ML estimate is generally not unbiased, it does have a numberof desirable properties. It can be shown that under relatively mild technicalconditions, the ML estimate is both consistent and asymptotically effi-cient. This means that the ML estimate attains the Cramer-Rao boundasymptotically as the number of independent data samples, n, goes to infin-ity [60]. Since this Cramer-Rao bound is a lower bound on the variance ofan unbiased estimator, this means that the ML estimate is about as good asany unbiased estimator can be. So if one has no idea what values of θ mayoccur, and needs to guarantee good performance for all cases, then the MLestimator is usually a good choice.

Example 2.3. Let Yknk=1 be i.i.d. random variables with Gaussian distribu-tion N(θ, σ2) and unknown mean parameter θ. For this case, the logarithmof the density function is given by

log pθ(Y ) = − 1

2σ2

n∑

k=1

(Yk − θ)2 − n

2log(

2πσ2)

.

Differentiating the log likelihood results in the following expression.

d log pθ(Y )

θ=θ

=1

σ2

n∑

k=1

(Yk − θ) = 0

From this we obtain the ML estimate for θ.

θ =1

n

n∑

k=1

Yk

Page 36: Model Based Image Processing (Text)

26 Probability, Estimation, and Random Processes

Notice that, by the following argument, this particular ML estimate is unbi-ased.

[

θ]

= Eθ

[

1

n

n∑

k=1

Yk

]

=1

n

n∑

k=1

Eθ[Yk] =1

n

n∑

k=1

θ = θ

Moreover, for this special case, it can be shown that the ML estimator is alsothe UMVU estimator [60].

Example 2.4. Again, let X1, · · · , Xn be n i.i.d. Gaussian random vectors eachwith multivariate Gaussian distribution given by N(µ,R), where µ ∈ R

p. Wewould like to compute the ML estimate of the parameter vector θ = [µ,R].Using the statistics b and S from Example 2.1, we can define the samplemean and covariance given by

µ = b/n (2.8)

R = (S/n)− µµt , (2.9)

then by manipulation of equation (2.6) the probability distribution of X canbe written in the form

p(x|θ) = 1

(2π)np/2|R|−n/2 exp

−n2tr

RR−1

− n

2(µ− µ)tR−1(µ− µ)

(2.10)Maximizing this expression with respect to θ then results in the ML estimateof the mean and covariance given by

argmax[µ,R]

p(x|µ,R) = [µ, R] .

So from this we see that the ML estimate of the mean and covariance of amultivariate Gaussian distribution is simply given by the sample mean andcovariance of the observations.

Example 2.5. Let X1, · · · , Xn be n i.i.d. Bernoulli random variables each withparameter θ. From Example 2.2, we know that

log p(x|θ) = (n−N1) log(1− θ) +N1 log θ ,

Page 37: Model Based Image Processing (Text)

2.3 Frequentist and Bayesian Estimators 27

where N1 is a sufficient statistic for the parameter θ. We can then computethe ML estimate by differentiating with respect to θ and setting the expressionto 0.

∂ log p(x|θ)∂θ

= −n−N1

1− θ+

N1

θ= 0

This yields the ML estimate for the parameter of the Bernoulli distribution.

θ =N1

n

This very intuitive results simply says that the ML estimate is given by theobserved fraction of times that Xn is 1.

2.3.2 Bayesian Estimation and the MAP Estimator

Since the ML estimator is asymptotically efficient, it is guaranteed to dowell for all values of the unknown parameter θ, as the amount of data growstowards infinity. So it might seem that nothing more can be done.

However, Bayesian methods attempt to exceed the accuracy of Frequentistestimators, such as the ML estimate, by making assumptions about valuesof the parameters that are most likely to occur. In practice, we will see thatBayesian estimation methods are most useful when the amount of data isrelatively small compared to the dimension of the unknown parameter.

In the Bayesian approach, we model the unknown quantity as random,rather than deterministic. In order to emphasize this distinction, we willuse the random variable X to denote the unknown quantity in Bayesianestimation, as opposed to the unknown parameter, θ, used in the frequentistapproach. As before, the estimator is then a function of the observationswith the form

X = T (Y ) ,

and once again the estimate, X, is a random vector.

The good news with Bayesian estimators is that once we make the as-sumption that X is random, then the design of estimators is conceptuallystraightforward, and the MSE of our estimator can be reduced by estimatingvalues of X that are more probable to occur. However, the bad news is that

Page 38: Model Based Image Processing (Text)

28 Probability, Estimation, and Random Processes

when we assume that X is a random vector, we must select some distributionfor it. In some cases, the distribution for X may be easy to select, but inmany cases, it may be very difficult to select a reasonable distribution ormodel for X. And in some cases, a poor choice of this prior distribution canseverely degrade the accuracy of the estimator.

In any case, let us assume that the joint distribution of both Y and X isknown, and let C(x, x) ≥ 0 be the cost of choosing x as our estimate if xis the correct value of the unknown. If our estimate is perfect, then x = x,which implies that C(x, x) = C(x, x) = 0; so the cost is zero. Of course, inmost cases our estimates will not be perfect, so our objective is to select anestimator that minimizes the expected cost. For a given value of X = x, theexpected cost is given by

C(x) = E[C(x, T (Y ))|X = x]

=

Rn

C(x, T (y))py|x(y|x)dy

where py|x(y|x) is the conditional distribution of the data, Y , given the un-known, X. Here again, the cost is a function of the unknown, X, but we canremove this dependency by taking the expectation to form what is known asthe Bayes’ risk.

Risk = E[C(X, T (Y ))]

= E[E[C(X, T (Y ))|X]]

= E[

C(X)]

=

C(x)px(x)dx

Notice, that the risk is not a function of X. This stands in contrast tothe Frequentist case, where the MSE of the estimator was a function of θ.However, the price we pay for removing this dependency is that the risk nowdepends critically on the choice of the density function px(x), which specifiesthe distribution on the unknown X. The distribution of X is known as theprior distribution since it is the distribution that X is assumed to haveprior to the observation of any data.

Of course, the choice of a specific cost function will determine the formof the resulting best estimator. For example, it can be shown that when the

Page 39: Model Based Image Processing (Text)

2.3 Frequentist and Bayesian Estimators 29

cost is squared error, so that C(x, x) = |x− x|2, then the optimal estimatoris given by the conditional expectation

XMMSE = E[X|Y ] ,

and when the cost is absolute error, so that C(x, x) = |x − x|, then theoptimal estimator is given by the conditional median.

∫ Xmedian

−∞px|y(x|Y )dx =

1

2

Another important case, that will be used extensively in this book, is whenthe cost is given by

C(x, x) = 1− δ(x− x) =

0 if x = x1 if x 6= x

.

Here, the cost is only zero when x = x, and otherwise the cost is fixed at1. This is a very pessimistic cost function since it assigns the same valuewhether the error is very small or very large. The optimal estimator forthis cost function is given by the so-called maximum a posteriori (MAP)estimate,

XMAP = argmaxx∈Ω

px|y(x|Y ) , (2.11)

where Ω is the set of feasible values for X, and the conditional distributionpx|y(x|y) is known as the posterior distribution because it specifies thedistribution of the unknown X given the observation Y .

Typically, it is most natural to express the posterior probability in termsof the forward model, py|x(y|x), and the prior model, px(x), using Bayes’rule.

px|y(x|y) =py|x(y|x)px(x)

py(y), (2.12)

In practice, the forward model can typically be formulated from a physicalmodel of how the measurements, Y , are obtained given an assumed image, X.The prior model, px(x), is then selected to accurately capture the variationsthat occur in the images being estimated.

Page 40: Model Based Image Processing (Text)

30 Probability, Estimation, and Random Processes

With this framework, the expression for the MAP estimate can then bereformulated as

XMAP = argmaxx∈Ω

log px|y(x|Y ) (2.13)

= argmaxx∈Ω

log py|x(y|x) + log px(x)− log py(y)

(2.14)

= argminx∈Ω

− log py|x(y|x)− log px(x)

. (2.15)

In this form, it is clear that the MAP estimate balances the need to fit thedata (i.e., minimize the forward model’s negative log likelihood) with fittingour prior model of how the reconstruction should appear (i.e., minimize thenegative log prior term). This balance of fitting the observed data whileremaining consistent with our the prior model represents the core of whatthe Bayesian framework attempts to achieve.

Example 2.6. Let X and W be Gaussian random variables with distributionsN(0, σ2

x) and N(0, σ2w), respectively. Furthermore, let Y = X +W . Our task

is then to estimate X from the observations of Y .

Using the definition of conditional probability, we may express the jointdistribution of X and Y as

py,x(y, x) = px|y(x|y)py(y) = py|x(y|x)px(x) .

Reorganizing terms results in Bayes’ rule, which is the source of the termi-nology Bayesian estimation.

px|y(x|y) =py|x(y|x)px(x)

py(y)

One approach to computing the posterior distribution is to directly evaluateBayes’ rule. However, this is somewhat cumbersome in this case, and forsome problems, it will actually be impossible. An alternative approach is toconsider the posterior as

px|y(x|y) =1

zypy,x(y, x) (2.16)

where zy is a normalizing constant or partition function for our problem.Since the posterior distribution is a probability density in x, the right side of

Page 41: Model Based Image Processing (Text)

2.3 Frequentist and Bayesian Estimators 31

equation (2.16) must integrate to 1 as a function of x. This means that zyis uniquely specified as the normalizing constant of the distribution. Notice,that the partition function may depend on y, but it may not depend on x.

Using this approach, we first evaluate the conditional data distribution,py|x(y|x), and prior distribution, px(x), for our problem. The prior is assumedto be

px(x) =1

2πσ2x

exp

− 1

2σ2x

x2

,

and the conditional density of the data is given by

py|x(y|x) =1

2πσ2w

exp

− 1

2σ2w

(y − x)2

.

This means the joint distribution of X and Y can be written in the form

px|y(x|y) =1

zypy|x(y|x)px(x)

=1

z′yexp

− 1

2σ2w

(y − x)2 − 1

2σ2x

x2

=1

z′′yexp

a(x− b)2

, (2.17)

where a and b are two appropriately chosen parameters. As with the partitionfunction zy, the parameters a and b can be functions of y, but they can notbe functions of x. Also notice that in general zy, z

′y, and z′′y are not equal,

but in each case, the partition function collects together all the multiplicativefactors in the expression that do not depend on x.

We can solve for the values of the parameters a and b by taking the firsttwo derivatives of the logarithms of the expressions and setting the derivativesto be equal. For the first derivative, this results in the following calculation.

d

dxlog

(

1

z′yexp

− 1

2σ2w

(y − x)2 − 1

2σ2x

x2)

=d

dxlog

(

1

z′′yexp

a(x− b)2

)

d

dx

(

− 1

2σ2w

(y − x)2 − 1

2σ2x

x2 − log z′y

)

=d

dx

(

a(x− b)2 − log z′′y)

− 1

σ2w

(x− y)− 1

σ2x

x = 2a(x− b)

Page 42: Model Based Image Processing (Text)

32 Probability, Estimation, and Random Processes

Differentiating this expression a second time yields the result that

a = −12

(

1

σ2w

+1

σ2x

)

,

and solving for b yields

b =

(

σ2x

σ2x + σ2

w

)

y .

In fact, looking at the expression of equation (2.17), one can see that theparameters b and a specify the posterior mean and variance, respectively.More specifically, if we define µx|y to be the mean of the posterior densityand σ2

x|y to be its variance, then we have the relationships that

− 1

2σ2x|y

= a = −12

(

1

σ2w

+1

σ2x

)

= −12

(

σ2w + σ2

x

σ2wσ

2x

)

µx|y = b =

(

σ2x

σ2x + σ2

w

)

y .

Solving for the conditional mean and variance, we can then write an explicitexpression for the conditional distribution of x given y as

px|y(x|y) =1

2πσ2x|y

exp

− 1

2σ2x|y

(x− µx|y)2

, (2.18)

where

µx|y =σ2x

σ2x + σ2

w

y

σ2x|y =

σ2xσ

2w

σ2x + σ2

w

.

While simple, the result of Example 2.6 is extremely valuable in providingintuition about the behavior of Bayesian estimates. First, from the form of(2.18), we can easily see that the MMSE estimate of X given Y is given by

XMMSE = E[X|Y ] =σ2x

σ2x + σ2

w

Y =1

1 + σ2w

σ2x

Y .

Page 43: Model Based Image Processing (Text)

2.3 Frequentist and Bayesian Estimators 33

Notice that the MMSE estimate is given by Y multiplied by a constant,0 ≤ σ2

x

σ2x+σ2

w< 1. In other words, the Bayesian estimate is simply an attenuated

version of Y . Moreover, the degree of attenuation is related to the ratio σ2w/σ

2x,

which is the noise-to-signal ratio. When the noise-to-signal ratio is low,the attenuation is low because Y is a good estimate of X; but when thenoise-to-signal ratio is high, then the attenuation is great because Y is onlyloosely correlated with X. While this attenuation can reduce mean-squareerror, it also results in an estimate which is biased because

E

[

XMMSE|X]

=σ2x

σ2x + σ2

w

X < X .

This scalar result can also be generalized to the case of jointly Gaussianrandom vectors to produce a result of general practical value as shown in thefollowing example.

Example 2.7. Let X ∼ N(0, Rx) and W ∼ N(0, Rw) be independent Gaus-sian random vectors, and let Y = X +W . Then the conditional distributionof X given Y can be calculated in much the same way as it was done forExample 2.6. The only difference is that the quadratic expressions are gen-eralized to matrix vector products and quadratic forms. (See problem 13)Under these more general conditions, the conditional distribution is given by

px|y(x|y) =1

(2π)p/2

∣Rx|y∣

−1/2exp

−12(x− µx|y)

tR−1x|y(x− µx|y)

, (2.19)

where

µx|y =(

R−1x +R−1w

)−1R−1w y

=(

I +RwR−1x

)−1y

= Rx (Rx +Rw)−1 y

Rx|y =(

R−1x +R−1w

)−1

= Rx (Rx +Rw)−1Rw ,

and the MMSE estimate of X given Y is then given by

XMMSE = E[X|Y ] = Rx (Rx +Rw)−1 Y . (2.20)

Page 44: Model Based Image Processing (Text)

34 Probability, Estimation, and Random Processes

At this point, there are two interesting observations to make, which areboth particular to the case of jointly Gaussian random variables. First, forjointly Gaussian random quantities, the posterior mean is a linear functionof the data y, and the posterior variance is not a function of y. These twoproperties will not hold for more general distributions. Second, when theobservation, Y , and unknown, X, are jointly Gaussian, then the posteriordistribution is Gaussian, so it is both a symmetric and unimodal function ofx. Therefore, for jointly Gaussian random quantities, the conditional mean,conditional median, and MAP estimates are all identical.

Xmedian = XMMSE = XMAP

However, for more general distributions, these estimators will differ.

2.3.3 Comparison of the ML and MMSE Estimators

In order to better understand the advantages and disadvantages of Bayesianestimators, we explore a simple example. Consider the case when X is aGaussian random vector with distribution N(0, Rx) and Y is formed by

Y = X +W

where W is a Gaussian random vector with distribution N(0, σ2wI). So in this

case, Y is formed by adding independent Gaussian noise with variance σ2w to

the components of the unknown vector X. Furthermore, let us assume thatthe covariance of X is formed by

[Rx]i,j =1

1 +∣

i−j10

2 , (2.21)

such that σw = 0.75 and the dimension is p = 50. Using this model, wecan generate a pseudo-random vector on a computer from the distributionof X. (See problem 7) Such a vector is shown in the upper left plot ofFigure 2.1. Notice, that X is a relatively smooth function. This is a resultof our particular choice of the covariance Rx. More specifically, because thecovariance drops off slowly as the |i − j| increases, nearby samples will behighly correlated, and it is probable (but not certain) that the function will

Page 45: Model Based Image Processing (Text)

2.4 Discrete-Time Random Processes 35

be smooth. However, once we add noise to the samples of X, correlationbetween nearby samples is largely lost. So the signal, Y , shown in Figure 2.1is quite noisy compared to X.

For this problem, the ML estimate of X given Y is simply Y itself! To seethis, we simply apply the definition of the ML estimate keeping in mind that,for this approach, X is considered to be a deterministic parameter ratherthan a random vector.

XML = argmaxx

1

(2πσ2w)

p/2exp

− 1

2σ2w

(Y − x)t(Y − x)

= Y

Alternatively, the MMSE estimate discussed in Example 2.7 can be computedusing the expression of equation (2.20).

Figure 2.1 shows the plots of the original signal, noisy signal, and boththe ML and MMSE estimates. For this example, the MMSE estimate ismuch better than the ML estimate because we have considerable knowledgeabout the behavior of X. While the ML estimate is unbiased, it does notuse this prior knowledge, so it produces an unsatisfying result. Moreover,as we mentioned in the introduction, the ML estimator tends to be mostsuitable when the number of parameters to be estimated is much less thanthe number of data points. However, in the this example there is only onedata point for each unknown parameter; so this situation is not favorable tothe ML estimate.

Alternatively, the MMSE estimate is not perfect, but it does seem tocapture the essential trends in the true signal X. However, the price we havepaid for this better estimate is that we are making strong assumptions aboutthe nature of X, and if those assumptions are not true then the estimate maybe very poor. In addition, the MMSE estimate will be biased. That is to saythat the shape of the signal XMMSE will be smoother than the actual signal.The tradeoff between bias and variance of an estimator is a fundamental one,which typically can not be avoided.

2.4 Discrete-Time Random Processes

Now that we have introduced a framework for random variables, we can usesequences of random variables to build discrete-time random processes.

Page 46: Model Based Image Processing (Text)

36 Probability, Estimation, and Random Processes

0 20 40

−2

0

2

Original Signal, X

0 20 40

−2

0

2

Signal with Noise, Y

0 20 40

−2

0

2

ML Estimate of X

0 20 40

−2

0

2

MMSE Estimate of X

Figure 2.1: This figure illustrates the potential advantage of a Bayesian estimateversus the ML estimate when the prior distribution is known. The original signalis sampled from the covariance of (2.21) and white noise is added to produce theobserved signal. In this case, the MMSE estimate is much better than the ML estimatebecause it uses prior knowledge about the original signal.

So for each integer n ∈ Z, let Xn be a random variable. Then we say thatXn is a discrete-time random process.

In order to fully specify the distribution of a random process, it is necessaryto specify the joint distribution of all finite subsets of the random variables.To do this, we can define the following finite-dimensional distribution

Fm,k(tm, · · · , tk) = P Xm ≤ tm, Xm+1 ≤ tm+1, · · · , Xk ≤ tk ,

where m and k are any integers with m ≤ k. The extension theorem(see for example [67] page 3) guarantees that if the set of finite-dimensionaldistributions is consistent for all m, k ∈ Z, then the distribution of the in-finite dimensional random process is well defined. So the set of all finitedimensional distributions specify the complete distribution of the randomprocess. Furthermore, if for all m ≤ k, the vector [Xm, Xm+1, · · · , Xk]

T isjointly Gaussian, then we say that the Xm is a Gaussian random process.

Page 47: Model Based Image Processing (Text)

2.4 Discrete-Time Random Processes 37

Often it is reasonable to assume that the properties of random processesdo not change over time. Of course, the actual values of the random processchange, but the idea is that the statistical properties of the random processare invariant. This type of time-invariance of random processes is known asstationarity. As it turns out, there are different ways to specify stationarityfor a random process. Perhaps the most direct approach is to specify thatthe distribution of the random process does not change when it is shifted intime. This is called strict-sense stationary, and it is defined below.

Definition 1. Strict-Sense Stationary Random ProcessA 1-D discrete-time random process Xn is said to be strict-sense sta-tionary if the finite dimensional distributions of the random process Xn

are equal to the finite dimensional distributions of the random processYn = Xn−k for all integers k. This means that

Fm,m+k(t0, t1, · · · , tk) = F0,k(t0, t1, · · · , tk) ,

for all integers m and k ≥ 1 and for all values of t0, t1, · · · , tk ∈ R.

Strict-sense stationarity is quite strong because it depends on verifyingthat all finite-dimensional distributions are equal for both the original randomprocess and its shifted version. In practice, it is much easier to check thesecond order properties of a random processes, than it is to check all itsfinite-dimensional distributions. To this end, we first define the concept of asecond-order random process.

Definition 2. Second Order Random ProcessA 1-D discrete-time random process Xn is said to be a second orderrandom process if for all n, k ∈ Z, E[|XnXk|] < ∞, i.e. all secondorder moments are finite.

If a random process is second order, then it has a well defined mean, µn,and time autocovariance, R(n, k), given by the following expressions.

µn = E[Xn]

R(n, k) = E[(Xn − µn)(Xk − µk)]

Armed with these concepts, we can now give the commonly used definitionof wide-sense stationarity.

Page 48: Model Based Image Processing (Text)

38 Probability, Estimation, and Random Processes

Definition 3. Wide-Sense Stationary Random ProcessA 1-D second-order discrete-time random process Xn is said to bewide-sense stationary if for all n, k ∈ Z, the E[Xn] = µ andE[(Xn − µ)(Xk − µ)] = R(n−k) where µ is a scalar constant and R(n)is a scalar function of n.

So a discrete-time random process is wide-sense stationary if its mean isconstant and its time autocovariance is only a function of n−k, the differencebetween the two times in question.

Reversibility is another important invariance property which holds whena strict-sense stationary random process, Xn, and its time-reverse, X−n, havethe same distribution. The formal definition of a reversible random pro-cess is listed below.

Definition 4. Reversible Random ProcessA 1-D discrete-time random process Xn is said to be reversible if itsfinite dimensional distributions have the property that

F0,k(t0, t1, · · · , tk) = Fm,m+k(tk, tk−1, · · · , t0) ,

for all integers m and k ≥ 1 and for all values of t0, t1, · · · , tk ∈ R.

Gaussian random processes have some properties which make them easierto analyze than more general random processes. In particular, the mean andtime autocovariance for a Gaussian random process provides all the informa-tion required to specify its finite-dimensional distributions. In practice, thismeans that the distribution of any Gaussian random process is fully specifiedby its mean and autocovariance, as stated in the following property.

Property 2.6. Autocovariance specification of Gaussian random processes -The distribution of a discrete-time Gaussian random process, Xn, is uniquelyspecified by its mean, µn, and time autocovariance, R(n, k).

If a Gaussian random process is also stationary, then we can equivalentlyspecify the distribution of the random process from its power spectral den-sity. In fact, it turns out that the power spectral density of a zero-meanwide-sense stationary Gaussian random process is given by the Discrete-time Fourier transform (DTFT) of its time autocovariance. More for-mally, if we define SX(e

jω) to be the expected power spectrum of the signal,

Page 49: Model Based Image Processing (Text)

2.4 Discrete-Time Random Processes 39

Xn, then the Wiener-Khinchin theorem states that for a zero-mean wide-sense stationary random process the power spectrum is given by the followingexpression,

SX(ejω) =

∞∑

n=−∞R(n)e−jωn

where the right-hand side of the equation is the DTFT of the time autoco-variance R(n).

Since the DTFT is an invertible transform, knowing SX(ejω) is equivalent

to knowing the time autocovariance R(n). Therefore the power spectrum alsofully specifies the distribution of a zero-mean wide-sense stationary Gaussianrandom process. The next property summarizes this important result.

Property 2.7. Power spectral density specification of a zero-mean wide-sensestationary Gaussian random process - The distribution of a wide-sense sta-tionary discrete-time Gaussian random process, Xn, is uniquely specified byits power spectral density, SX

(

ejω)

.

Finally, we consider reversibility of Gaussian random processes. So if Xn

is a wide-sense stationary Gaussian random process, we can define its time-reversed version as Yn = X−n. Then by the definition of time autocovariance,we know that

RY (n) = E[(Yk − µ)(Yk+n − µ)]

= E[(X−k − µ)(X−k−n − µ)]

= E[(Xl+n − µ)(Xl − µ)]

= RX(n)

where l = −k − n, and µ is the mean of both Xn and Yn. From this, weknow that Xn and its time reverse, Yn, have the same autocovariance. ByProperty 2.6, this means that Xn and Yn have the same distribution. Thisleads to the following property.

Property 2.8. Reversibility of stationary Gaussian random processes - Anywide-sense stationary Gaussian random process is also strict-sense stationaryand reversible.

Finally, we note that all of these properties, strict-sense stationarity, wide-sense stationarity, autocovariance, power spectral density, and reversibility

Page 50: Model Based Image Processing (Text)

40 Probability, Estimation, and Random Processes

have natural generalizations in 2-D and higher dimensions. In particular, letXs1,s2 be a 2-D discrete-space random process that is wide-sense stationary.Then its 2-D autocovariance function is given by

R(s1 − r1, s2 − r2) = E[(Xs1,s2 − µ)(Xr1,r2 − µ)] .

where µ = E[Xs1,s2]. Furthermore, the 2-D power spectral density of Xs1,s2 isgiven by

SX(ejω1, ejω2) =

∞∑

s1=−∞

∞∑

s2=−∞R(s1, s2)e

−jω1s1−jω2s2 (2.22)

where the right-hand side of this equation is known as the discrete-spaceFourier transform (DSFT) of the 2-D autocovariance. In addition, the 2-Drandom process is said to be stationary if Xs1,s2 and Ys1,s2 = Xs1−k1,s2−k2 havethe same distribution for all integers k1 and k2; and the 2-D random process issaid to be reversible if Xs1,s2 and Ys1,s2 = X−s1,−s2 have the same distribution.Again, it can be shown that 2-D zero-mean wide-sense stationary Gaussianrandom processes are always reversible and strict-sense stationary.

Page 51: Model Based Image Processing (Text)

2.5 Chapter Problems 41

2.5 Chapter Problems

1. Let Y be a random variable which is uniformly distributed on the interval[0, 1]; so that it has a PDF of py(y) = 1 for 0 ≤ y ≤ 1 and 0 otherwise.Calculate the CDF of Y and use this to calculate both the CDF andPDF of Z = Y 2.

2. In this problem, we present a method for generating a random vari-able, Y , with any valid CDF specified by Fy(t). To do this, let X bea uniformly distributed random variable on the interval [0, 1], and letY = f(X) where we define the function

f(u) = inft ∈ R|Fy(t) ≥ u .

Prove that in the general case, Y has the desired CDF. (Hint: First showthat the following two sets are equal, (−∞, Fy(t)] = u ∈ R : f(u) ≤ t.)

3. Give an example of three random variables, X1, X2, and X3 such thatfor k = 1, 2, 3, PXk = 1 = PXk = −1 = 1

2 , and such Xk and Xj areindependent for all k 6= j, but such that X1, X2, and X3 are not jointlyindependent.

4. Let X be a jointly Gaussian random vector, and let A ∈ RM×N be a

rank M matrix. Then prove that the vector Y = AX is also jointlyGaussian.

5. Let X ∼ N(0, R) where R is a p× p symmetric positive-definite matrix.

a) Prove that if for all i 6= j, E[XiXj] = 0 (i.e., Xi and Xj are uncorre-lated), then Xi and Xj are pair-wise independent.

b) Prove that if for all i, j, Xi and Xj are uncorrelated, then the com-ponents of X are jointly independent.

6. Let X ∼ N(0, R) where R is a p× p symmetric positive-definite matrix.Further define the precision matrix, B = R−1, and use the notation

B =

[

1/σ2 AAt C

]

,

where A ∈ R1×(p−1) and C ∈ R

(p−1)×(p−1).

Page 52: Model Based Image Processing (Text)

42 Probability, Estimation, and Random Processes

a) Calculate the marginal density of X1, the first component of X, giventhe components of the matrix R.

b) Calculate the conditional density of X1 given all the remaining com-ponents, Y = [X2, · · · , Xp]

t.

c) What is the conditional mean and covariance of X1 given Y ?

7. Let X ∼ N(0, R) where R is a p× p symmetric positive-definite matrixwith an eigen decomposition of the form R = EΛEt.

a) Calculate the covariance of X = EtX, and show that the componentsof X are jointly independent Gaussian random variables. (Hint: Use theresult of problem 5 above.)

b) Show that if Y = EΛ1/2W where W ∼ N(0, I), then Y ∼ N(0, R).How can this result be of practical value?

8. For each of the following cost functions, find expressions for the minimumrisk Bayesian estimator, and show that it minimizes the risk over allestimators.

a) C(x, x) = |x− x|2.b) C(x, x) = |x− x|

9. Let Yini=1 be i.i.d. Bernoulli random variables with distribution

P Yi = 1 = θ

P Yi = 0 = 1− θ

Compute the ML estimate of θ.

10. Let Xini=1 be i.i.d. random variables with distribution

PXi = k = πk

where∑m

k=1 πk = 1. Compute the ML estimate of the parameter vectorθ = [π1, · · · , πm]. (Hint: You may use the method of Lagrange multipliersto calculate the solution to the constrained optimization.)

11. Let X1, · · · , Xn be i.i.d. random variables with distribution N(µ, σ2).Calculate the ML estimate of the parameter vector (µ, σ2).

Page 53: Model Based Image Processing (Text)

2.5 Chapter Problems 43

12. LetX1, · · · , Xn be i.i.d. Gaussian random vectors with distributionN(µ,R)where µ ∈ R

p and R ∈ Rp×p is a symmetric positive-definite matrix. Let

θ = [µ,R] denote the parameter vector for the distribution.

a) Derive the expressions for the probability density of p(x|θ) with theforms given in equations (2.6) and (2.10). (Hint: Use the trace propertyof equation (2.7).)

b) Compute the joint ML estimate of µ and R.

13. Let X and W be independent Gaussian random vectors of dimension p

such that X ∼ N(0, Rx) and W ∼ N(0, Rw), and let θ be a deterministicvector of dimension p.

a) First assume that Y = θ + W , and calculate the ML estimate of θgiven Y .

b) For the next parts, assume that Y = X + W , and calculate an ex-pression for px|y(x|y), the conditional density of X given Y .

c) Calculate the MMSE estimate of X when Y = X +W .

d) Calculate an expression for the conditional variance of X given Y .

14. Show that if X and Y are jointly Gaussian random vectors, then theconditional distribution of X given Y is also Gaussian.

15. Prove that if X ∈ RM and Y ∈ R

N are zero-mean jointly Gaussianrandom vectors, then E[X|Y ] = AY and

E[

(X − E[X|Y ])(X − E[X|Y ])t|Y]

= C ,

where A ∈ RM×N and C ∈ R

M×M , i.e., Property 2.5.

16. Let Y ∈ RM andX ∈ R

N be zero-mean jointly Gaussian random vectors.Then define the following notation for this problem. Let p(y, x) andp(y|x) be the joint and conditional density of Y given X. Let B be thejoint positive-definite precision matrix (i.e., inverse covariance matrix)

given by B−1 = E[ZZt] where Z =

[

YX

]

. Furthermore, let C, D, and

E be the matrix blocks that form B, so that

B =

[

C DDt E

]

.

Page 54: Model Based Image Processing (Text)

44 Probability, Estimation, and Random Processes

where C ∈ RM×M , D ∈ R

M×N , and E ∈ RN×N . Finally, define the

matrix A so that AX = E[Y |X], and define the matrix

Λ−1 = E[

(Y − E[Y |X])(Y − E[Y |X])t|X]

.

a) Write out an expression for p(y, x) in terms of B.

b) Write out an expression for p(y|x) in terms of A and Λ.

c) Derive an expression for Λ in terms of C, D, and E.

d) Derive an expression for A in terms of C, D, and E.

17. Let Y andX be random variables, and let YMAP and YMMSE be the MAPand MMSE estimates respectively of Y given X. Pick distributions forY and X so that the MAP estimator is very “poor”, but the MMSEestimator is “good”.

18. Prove that two zero-mean discrete-time Gaussian random processes havethe same distribution, if and only if they have the same time autocovari-ance function.

19. Prove all Gaussian wide-sense stationary random processes are:a) strict-sense stationaryb) reversible

20. Construct an example of a strict-sense stationary random process thatis not reversible.

21. Consider two zero-mean Gaussian discrete-time random processes, Xn

and Yn related byYn = hn ∗Xn ,

where ∗ denotes discrete-time convolution and hn is an impulse responsewith

n |hn| <∞. Show that

Ry(n) = Rx(n) ∗ hn ∗ h−n .

Page 55: Model Based Image Processing (Text)

Chapter 3

Causal Gaussian Models

Perhaps the most basic tool in modeling is prediction. Intuitively, if one caneffectively predict the behavior of something, then one must have an accuratemodel of its behavior. Clearly, an accurate model can enable accurate pre-diction, but we will demonstrate that the converse is also true: an accuratepredictor can be used to create an accurate model.

In order to model data using prediction, we must decide the order in whichprediction will occur. The simplest approach is to predict values in causalorder, starting in the past and proceeding toward the future. In this chapter,we will show that causal prediction leads to many interesting and powerfultools; and, perhaps most importantly, it eliminates the possibility of circulardependencies in the prediction model.

However, the price we pay for causal prediction is that it requires that weimpose a causal ordering on the data. For some types of data, causal orderingis quite natural. However, for images, which are the primary subject of thisbook, this is typically not the case, and imposing a causal order can oftenlead to artifacts in the results of processing.

3.1 Causal Prediction in Gaussian Models

Let X1, X2, · · · , XN be a portion of a discrete-time Gaussian random process.Without loss of generality, we will assume that Xn is zero-mean, since wemay always subtract the mean in a preprocessing step. At any particulartime n, we may partition the random process into three distinct portions.

The Past - Xk for 1 ≤ k < n

Page 56: Model Based Image Processing (Text)

46 Causal Gaussian Models

The Present - Xn

The Future - Xk for n < k ≤ N

Our objective is to predict the current value, Xn, from the past. As we sawin Chapter 2, one reasonable predictor is the MMSE estimate of Xn given by

Xn= E[Xn|Xi for i < n] .

We will refer to X as a causal predictor since it only uses the past to predictthe present value, and we define the causal prediction error as

En = Xn − Xn .

In order to simplify notation, let Fn denote the set of past observations givenby Fn = Xi for i < n. Then the MMSE causal predictor of Xn can besuccinctly expressed as

Xn = E[Xn|Fn] .

Causal prediction leads to a number of very interesting and useful prop-erties, the first of which is listed below.

Property 3.1. Linearity of Gaussian predictor - The MMSE causal predictorfor a zero-mean Gaussian random process is a linear function of the past, i.e.,

Xn = E[Xn|Fn] =n−1∑

i=1

hn,iXi (3.1)

where hn,i are scalar coefficients.

This property is a direct result of the linearity of conditional expectationfor zero-mean Gaussian random vectors (Property 2.5). From this, we alsoknow that the prediction errors must be a linear function of the past andpresent values of X.

En = Xn −n−1∑

i=1

hn,iXi (3.2)

Another important property of causal prediction is that the predictionerror, En, is uncorrelated from all past values of Xi for i < n.

E[XiEn] = E

[

Xi(Xn − Xn)]

Page 57: Model Based Image Processing (Text)

3.1 Causal Prediction in Gaussian Models 47

= E[XiXn]− E

[

XiXn

]

= E[XiXn]− E

[

XiE[Xn|Fn]]

= E[XiXn]− E

[

E[XiXn|Fn]]

= E[XiXn]− E[XiXn]

= 0

Notice that the fourth equality is a result of Property 2.4, and the fifth equal-ity is a result of Property 2.3. Since the combination of En and X0, · · · , Xn−1are jointly Gaussian, this result implies that the prediction errors are inde-pendent of past values of X, which is stated in the following property.

Property 3.2. Independence of causal Gaussian prediction errors from past -The MMSE causal prediction errors for a zero-mean Gaussian random processare independent of the past of the random process. Formally, we write thatfor all n

En ⊥⊥ (X1, · · · , Xn−1) ,

where the symbol ⊥⊥ indicates that the two quantities on the left and rightare jointly independent of each other.

A similar approach can be used to compute the autocovariance betweenpredictions errors themselves. If we assume that i < n, then the covariancebetween prediction errors is given by

E[EnEi] = E

[(

Xn − Xn

)(

Xi − Xi

)]

= E

[

(Xn − E[Xn|Fn]) (Xi − E[Xi|Fi])]

= E

[

E

[

(Xn − E[Xn|Fn]) (Xi − E[Xi|Fi])∣

∣Fn

]]

= E

[

(Xi − E[Xi|Fi])E[

(Xn − E[Xn|Fn])∣

∣Fn

]]

= E[(Xi − E[Xi|Fi]) (E[Xn|Fn]− E[Xn|Fn])]

= E[(Xi − E[Xi|Fi]) 0] = 0 .

By symmetry, this result must also hold for i > n. Also, since we know thatthe prediction errors are jointly Gaussian, we can therefore conclude jointindependence from this result.

Page 58: Model Based Image Processing (Text)

48 Causal Gaussian Models

Property 3.3. Joint independence of causal Gaussian prediction errors - TheMMSE causal prediction errors for a zero-mean Gaussian random process arejointly independent which implies that for all i 6= j, Ei ⊥⊥ Ej.

The causal prediction errors are independent, but we do not know theirvariance. So we denote the causal prediction variance as

σ2n= E

[

E2n]

.

The prediction equations of (3.1) and (3.2) can be compactly expressed us-ing vector-matrix notation. To do this, we letX, X, and E denote column vec-tors with elements indexed from 1 to N . So for example, X = [X1, · · · , XN ]

t.Then the causal prediction equation of (3.1) becomes

X = HX (3.3)

where H is an N ×N causal prediction matrix containing the predictioncoefficients, hi,j. By relating the entries of H to the coefficients of (3.1), wecan see that H is a lower triangular matrix with zeros on the diagonal andwith the following specific form.

H =

0 0 · · · 0h2,1 0 0 · · · 0...

... . . . . . . ...hN−1,1 hN−1,2 · · · 0 0hN,1 hN,2 · · · hN,N−1 0

Using this notation, the causal prediction error is then given by

E = (I −H)X = AX , (3.4)

where A = I −H.

3.2 Density Functions Based on Causal Prediction

We can derive compact expressions for the density of both the predictionerror, E , and the data, X, by using the vector-matrix notation of the previoussection. To do this, first define Λ = diag

σ21, · · · , σ2

N

to be a diagonal matrix

Page 59: Model Based Image Processing (Text)

3.3 1-D Gaussian Autoregressive (AR) Models 49

containing the causal prediction variances. Then the covariance of E is givenby

E[

EE t]

= Λ

due to the independence of the prediction errors. Using the general form ofthe density function for a zero-mean multivariate Gaussian random vector,we then can write the density function for E as

pE(e) =1

(2π)N/2|Λ|−1/2 exp

−12etΛ−1e

. (3.5)

Since E and X are related through a bijective transformation, it can beeasily shown that the density ofX is proportional to the density of E , with theabsolute value of the Jacobian determinant of the transformation servingas the constant of proportionality. For this particular linear relationshipbetween X and E , the probability densities are related by

px(x) = |det(A)| pE(Ax)

where |det(A)| is the absolute value of the determinant of the matrix A.Fortunately, because A is a causal predictor, it is constrained to be lower tri-angular with 1’s on its diagonal. Therefore, its determinant is one. Applyingthis result, and using the form of the density function for pE(e) of (3.5) yields

px(x) =1

(2π)N/2|Λ|−1/2 exp

−12xtAtΛ−1Ax

. (3.6)

From this, we can also see that the covariance of X is given by

RX = (AtΛ−1A)−1 ,

where A is the causal prediction matrix and Λ is the diagonal matrix of causalprediction variances.

3.3 1-D Gaussian Autoregressive (AR) Models

Time invariance is a very important concept that plays an essential role inthe modeling of data. This is because in many practical cases it is reasonableto assume that the characteristic behavior of data does not change with time.One method for enforcing time-invariance in a random processes is to specify

Page 60: Model Based Image Processing (Text)

50 Causal Gaussian Models

Xn-2 Xn-1 Xn Xn+1 Xn+2Xn-3 Xn+3

H(ejω)+

-

en

Figure 3.1: Diagram of a causal predictor for a P th order Gaussian AR process.The linear time-invariant prediction filter, hn, has frequency response, H(ω). Theresulting prediction errors, En, are white when the predictor is optimal.

that the parameters of the model do not change with time. When this isthe case, we say that the model is homogeneous. So for example, a causalprediction model is homogeneous if the prediction filter and the predictionvariance do not change with time. In this case, the MMSE causal predictormust be a linear time-invariant filter, so that the predictions are given by

Xn =N∑

i=1

hn−iXi ,

where hn is a causal prediction filter (i.e., hn = 0 for n ≤ 0) and thecausal prediction variances take on a constant value of σ2

C .

When the prediction filter is time invariant, then the prediction matrices,H and A, of equations (3.3) and (3.4) are said to be Toeplitz. A matrix isToeplitz if there is a function, hn, so that Hi,j = hi−j. The structure of aToeplitz matrix is illustrated in Figure 3.2. Intuitively, each row of a Toeplitzmatrix is a shifted version of a single 1-D function, and multiplication by aToeplitz matrix is essentially time-invariant convolution, but using truncatedboundary conditions. Toeplitz matrices arise in many applications, and theirspatial structure sometimes presents computational advantages.

In the same way that Toeplitz matrices arise from convolution with trun-cated boundaries, circulant matrices arise when convolution is implementedwith circular boundary conditions. In this case, Hi,j = h(i−j)modN wheremodN specifies the use of modulo N arithmetic. Multiplication by a circu-lant matrix, H, is equivalent to circular convolution with the function hn.Circulant matrices have many useful properties because we know that cir-cular convolution can be implemented with multiplication after taking thediscrete Fourier transform (DFT) of a signal.

Page 61: Model Based Image Processing (Text)

3.3 1-D Gaussian Autoregressive (AR) Models 51

H =

h0 h−1 · · · h2−N h1−N

h1 h0 · · · h3−N h2−N...

.... . .

......

hN−2 hN−3 · · · h0 h−1

hN−1 hN−2 · · · h1 h0

H =

h0 hN−1 · · · h2 h1

h1 h0 · · · h3 h2...

.... . .

......

hN−2 hN−3 · · · h0 hN−1

hN−1 hN−2 · · · h1 h0

Toeplitz Circulant

Figure 3.2: Diagram illustrating the structure of N×N Toeplitz and circulant matri-ces. Toeplitz matrices represent truncated convolution in time, and circulant matricesrepresent circular convolution in time.

A simple way to get around problems with boundary conditions is toextend the random process Xn so that n = −∞, · · · ,−1, 0, 1, · · · ,∞. Whenthe signal has infinite extent, then we can use the standard notation of lineartime-invariant systems. In this case,

En = Xn − Xn

= Xn −Xn ∗ hn

= Xn ∗ (δn − hn) , (3.7)

where ∗ denotes 1-D discrete-time convolution. Turning things around, wemay also write

Xn = En +Xn ∗ hn

= En +P∑

i=1

Xn−ihi , (3.8)

which is the form of a P th order infinite impulse response (IIR) filter.

When P = ∞, then all past values of Xn can be used in the MMSEprediction. However if P <∞, then the prediction only depends on the lastP observations, and we call Xn an autoregressive (AR) random process.Figure 3.3 shows how the predictor in an order P AR model only dependson the P past neighbors.

Equation (3.8) is also sometimes called a white noise driven modelfor the AR process because it has the form of an linear time-invariant(LTI) system with a white noise input, En. The white noise driven model isparticularly useful because it provides an easy method for generating an AR

Page 62: Model Based Image Processing (Text)

52 Causal Gaussian Models

process, Xn. To do this, one simply generates a sequence of i.i.d. Gaussianrandom variables with distribution N(0, σ2

C), and filters them with the IIRfilter of equation (3.8). If the IIR filter is stable, then its output, Xn, will bea stationary random process.

We can calculate the autocovariance of the AR process, Xn, by using therelationship of equation (3.8). Since the prediction errors, En, are i.i.d., weknow that their time autocovariance is given by

RE(i− j) = E[EiEj] = σ2Cδi−j .

From the results of Section 2.4 (See problem 21 of Chapter 2), and the rela-tionship of equation (3.7), we know that the autocovariance of Xn obeys thefollowing important relationship

RX(n) ∗ (δn − hn) ∗ (δn − h−n) = RE(n) = σ2Cδn . (3.9)

Taking the DTFT of the time autocovariance, we then get an expression forthe power spectral density of the AR process.

SX(ω) =σ2C

|1−H(ω)|2 . (3.10)

Example 3.1. Consider the P th order AR random process X1, · · · , XN withprediction variance of σ2

C and prediction errors given by

En = Xn −P∑

i=1

hiXn−i . (3.11)

To simplify notation, we will assume that Xn = 0 when n < 0, so that we donot need to use special indexing at the boundaries of the signal.

Our task in this example is to compute the joint ML estimate of theprediction filter, hn, and the prediction variance, σ2

C . To do this, we firstmust compute the probability density of X. Using the PDF of equation(3.6), we can write the density for the AR process as

p(x) =1

(2πσ2C)

N/2exp

− 1

2σ2C

N∑

n=1

(

xn −P∑

i=1

hixn−i

)2

.

Page 63: Model Based Image Processing (Text)

3.3 1-D Gaussian Autoregressive (AR) Models 53

We can further simplify the expression by defining the following parametervector and statistic vector.

h = [h1, h2, · · · , hP ]t

Zn = [Xn−1, Xn−2, · · · , Xn−P ]t

Then the log likelihood of the observations, X, can be written as

log p(X) = −N2log(

2πσ2C

)

− 1

2σ2C

N∑

n=1

(

Xn −P∑

i=1

hiXn−i

)2

= −N2log(

2πσ2C

)

− 1

2σ2C

N∑

n=1

(

Xn − htZn

) (

Xn − htZn

)t

= −N2log(

2πσ2C

)

− 1

2σ2C

N∑

n=1

(

X2n − 2htZnXn + htZnZ

tnh)

Using this, we can express the log likelihood as

log p(X) = −N2log(

2πσ2C

)

− N

2σ2C

(

σ2x − 2htb+ htRh

)

where

σ2x =

1

N

N∑

n=1

X2n

b =1

N

N∑

n=1

ZnXn

R =1

N

N∑

n=1

ZnZtn .

Notice that the three quantities σ2x, b, and R are sample statistics computed

from the data, X. Intuitively, they correspond to estimates of the varianceof Xn, the covariance between Zn and Xn, and the autocovariance of Zn.

First, we compute the ML estimate of the prediction filter by taking thegradient with respect to the filter vector h.

∇h log p(X) = − N

2σ2C

∇h

(

htRh− 2htb)

= −N

σ2C

(

Rh− b)

,

Page 64: Model Based Image Processing (Text)

54 Causal Gaussian Models

where we use the convention that the gradient is represented as a columnvector. Setting the gradient of the log likelihood to zero, results in the MLestimate of the prediction filter, h.

h = R−1b

We can next compute the ML estimate of σ2C by plugging in the expression

for the ML estimate of h, and differentiating with respect to the parameterσ2C .

d

dσ2C

log p(X) =d

dσ2C

[

−N2log(

2πσ2C

)

− N

2σ2C

(

σ2x − btR−1b

)

]

= −N2

[

1

σ2C

− 1

σ4C

(

σ2x − btR−1b

)

]

.

Setting the derivative of the log likelihood to zero, results in the expression

1− 1

σ2C

(

σ2x − btR−1b

)

= 0

Which yields the ML estimate of the causal prediction variance given by

σ2C = σ2

x − btR−1b .

Perhaps a more intuitive representation for σ2C is as the average of the squared

prediction errors.

σ2C =

1

N

N∑

n=1

(

Xn − htZn

)2

=1

N

N∑

n=1

E2n

3.4 2-D Gaussian AR Models

In fact, the analysis of 1-D AR models from the previous sections is easilygeneralized to a regular grid in 2 or more dimensions. To do this, eachlattice point is represented by s = (s1, s2), where s is a vector index with

Page 65: Model Based Image Processing (Text)

3.4 2-D Gaussian AR Models 55

• • ⊗• • • • •• • • • •• • ⊗

1-D AR order P = 2 2-D AR order P = 2

Figure 3.3: Structure of 1-D and 2-D AR prediction window for order P = 2 models.The pixel denoted by the symbol ⊗ is predicted using the past values denoted by thesymbol •. For the 1-D case, P = 2 past values are used by the predictor; and forthe 2-D case, 2P (P + 1) = 12 past values are used by the predictor. Notice that theasymmetric shape of the 2-D prediction window results from raster ordering of thepixels.

each coordinate taking on values in the range 1 to N . When visualizing 2-Dmodels, we will generally assume that s1 is the row index of the data arrayand s2 is the column index.

The key issue in generalizing the AR model to 2-D is the ordering of thepoints in the plane. Of course, there is no truly natural ordering of thepoints, but a common choice is raster ordering, going left to right and topto bottom in much the same way that one reads a page of English text. Usingthis ordering, the pixels of the image, Xs, may be arranged into a vector withthe form

X = [X1,1, · · · , X1,N , X2,1, · · · , X2,N , · · · , XN,1, · · · , XN,N ]t ,

and the causal prediction errors, E , may be similarly ordered. If we assumethat X(s1,s2) = 0 outside the range of 1 ≤ s1 ≤ N and 1 ≤ s2 ≤ N , then the2-D causal prediction error can again be written as

Es = Xs −∑

r∈WP

hrXs−r ,

where WP is a window of past pixels in 2-D. Typically, this set is given by

WP =

r = (r1, r2) :(r1 = 0 and 1 ≤ r2 ≤ P )

or(1 ≤ r1 ≤ P and − P ≤ r2 ≤ P )

. (3.12)

Notice that using this definition of W , the prediction sum only contains pre-vious pixels of Xs in raster order. The resulting asymmetric window shown inFigure 3.3 contains a total of 2P (P +1) pixels. The window is not symmetricbecause it is constrained by the raster ordering.

Page 66: Model Based Image Processing (Text)

56 Causal Gaussian Models

H =

B0 B−1 · · · B1−N

B1 B0 · · · B2−N

......

. . ....

BN−1 BN−2 · · · B0

Bk =

h(k,0) h(k,−1) · · · h(k,1−N)

h(k,1) h(k,0) · · · h(k,2−N)...

.... . .

...h(k,N−1) h(k,N−2) · · · h(k,0)

Figure 3.4: Diagram illustrating the structure of a Toeplitz block Toeplitz matrix.The N2 × N2 matrix is made up of blocks which are each of size N × N . Noticethat the blocks are organized in a Toeplitz structure, and each block, Bk , is itselfToeplitz.

Using this convention, the prediction errors can be expressed in matrixform as

E = (I −H)X ,

where H is the 2-D prediction matrix.

Since H represents the application of a linear space-invariant 2-D filter,it has a special structure and is referred to as a Toeplitz block Toeplitzmatrix. Figure 3.4 illustrates the structure graphically. Notice that thematrix H is formed by a set of blocks, Bk, organized in a Toeplitz structure.In addition, each individual block is itself a Toeplitz matrix, which explainsthe terminology. For our problem each block is of size N ×N ; so in this case,the Toeplitz block Toeplitz structure implies that the matrix, Hi,j, can beexpressed in the form

HmN+k,nN+l = h(m−n,k−l)

where h(i,j) is the 2-D prediction filter’s impulse response. Intuitively, aToeplitz block Toeplitz matrix results whenever space-invariant filters arerepresented as matrix operators and the pixels in the image are organized inraster order.

The 2-D AR model also has properties quite similar to the 1-D case. Infact, the results are formally identical, only with 1-D convolution being re-placed by 2-D convolution and the 1-D DTFT being replaced by the 2-DDSFT. More specifically,

RX(s) ∗ (δs − hs) ∗ (δs − h−s) = σ2Cδs , (3.13)

Page 67: Model Based Image Processing (Text)

3.4 2-D Gaussian AR Models 57

where ∗ denotes 2-D convolution of 2-D functions, and

SX(µ, ν) =σ2C

|1−H(µ, ν)|2. (3.14)

where H(µ, ν) is the DSFT of hs, and SX(µ, ν) is the 2-D power spectraldensity of the AR process. (See Section 2.4 for details of the 2-D powerspectrum.)

Example 3.2. Consider the P th order 2-D AR random process Xs for s ∈ S =(s1, s2) : 1 ≤ s1, s2 ≤ N with prediction variance of σ2

C and predictionerrors given by

Es = Xs −∑

r∈WhrXs−r . (3.15)

As before, we will assume that Xs = 0 when s1 < 0 or s2 < 0. Followingalong the lines of Example 3.1, we can compute the probability density of Xusing the PDF of equation (3.6).

p(x) =1

(2πσ2C)

N2/2exp

− 1

2σ2C

s∈S

(

xs −∑

r∈Whrxs−r

)2

.

In 2-D, we can define the following parameter vector and statistic vector.

h =[

h(0,1), · · · , h(0,P ), h(1,−P ), · · · , h(1,P ), · · · , h(P,P )

]t

Zs =[

Xs−(0,1), · · · , Xs−(0,P ), Xs−(1,−P ), · · · , Xs−(1,P ), · · · , Xs−(P,P )

]t.

Using these definitions, the prediction error can be compactly written as

Es = Xs − htZs ,

and the log likelihood can be written as

log p(X) = −N2

2log(

2πσ2C

)

− N 2

2σ2C

(

σ2x − 2htb+ htRh

)

where

σ2x =

1

N 2

s∈SX2

s

Page 68: Model Based Image Processing (Text)

58 Causal Gaussian Models

b =1

N 2

s∈SZsXs

R =1

N 2

s∈SZsZ

ts .

A calculation similar to that in Example 3.1 then results in the ML estimatesof the model parameters h and σ2

C .

h = R−1b

σ2C = σ2

x − btR−1b ,

or equivalently

σ2C =

1

N 2

s∈S

(

Xs − htZs

)2

.

Page 69: Model Based Image Processing (Text)

3.5 Chapter Problems 59

3.5 Chapter Problems

1. Let XnNn=1 be a 1-D Gaussian random process such that

En = Xn −n−1∑

i=n−Phn−iXi

results in En being a sequence of i.i.d. N(0, σ2) random variables forn = 1, · · · , N , and assume that Xn = 0 for n ≤ 0. Compute the MLestimates of the prediction filter hn and the prediction variance σ2.

2. Let Xn be samples of a Gaussian AR process with order P and param-eters (σ2, h). Also make the assumption that Xn = 0 for n ≤ 0.

a) Use Matlab to generate 100 samples of X. Experiment with a varietyof values for P and (σ2, h). Plot your output for each experiment.

b) Use your sample values of X generated in part a) to compute the MLestimates of the (σ2, h), and compare them to the true values.

3. Let X be a Gaussian 1-D AR process with hn = ρδn−1 and predictionvariance σ2.

a) Analytically calculate SX(ω), the power spectrum of X, and RX(n),the autocovariance function for X.

b) Plot SX(ω) and RX(n) for ρ = 0.5 and ρ = 0.95.

4. Let Xn be a zero-mean wide-sense stationary random process, and define

Zn =

Xn−1...

Xn−P

for some fixed order P , and let

R = E

[

1

N

N−1∑

n=0

ZnZtn

]

a) Show that R is a Toeplitz matrix.

b) Show that R is a positive semi-definite matrix.

Page 70: Model Based Image Processing (Text)

60 Causal Gaussian Models

5. Consider an LTI system with input xn, output, yn, and impulse response,hn, so that yn = hn ∗ xn, where ∗ denotes convolution. Also define thevectors, y = [y0, · · · , yN−1]t, and x = [x0, · · · , xN−1]t. Show that if xn = 0for n < 0 and n ≥ N , then

y = Ax

where A is a Toeplitz matrix.

6. Consider a linear system with input xnN−1n=0 , output, ynN−1n=0 , andimpulse response, hnN−1n=0 , so that yn = hn ⊛ xn, where ⊛ denotescircular convolution. Also define the vectors, y = [y0, · · · , yN−1]t, andx = [x0, · · · , xN−1]t. Show that if xn = 0 for n ≤ 0 and n > N , then

y = Ax

where A is a circulant matrix.

7. Let A be an N ×N circulant matrix, so that Ai,j = h(i−j)modN , for somereal-valued function hn. In order to simplify notation, we will assumeall matrices in this problem are indexed from 0 to N − 1, rather thanfrom 1 to N . Using this convention, define the following matrix for0 ≤ m,n < N ,

Tm,n =1√Ne−j

2πmnN .

Then T is known as the N dimensional orthonormal discrete Fouriertransform (DFT).1

a) Show that the DFT is an orthonormal transform by showing thatthe columns of the matrix are orthogonal and normal. So formally thismeans for 0 ≤ m, k < N

N−1∑

n=0

Tm,nT∗k,n = δm−k .

b) Show that inverse transformation is given by

[

T−1]

m,n= T ∗n,m

1The DFT is conventionally defined without the factor of 1√N, but we add this constant to normalize the

transform.

Page 71: Model Based Image Processing (Text)

3.5 Chapter Problems 61

where T−1 is the inverse DFT.

c) Show that Λ = TAT−1 is a diagonal matrix with entries given bythe DFT of the function hn. That is Λ = diag λ0, · · · , λN−1 whereλm =

√N∑N−1

n=0 Tm,nhn.

d) Show that the eigenvalues of A are the diagonal entries of Λ and thatthe eigenvectors are the corresponding columns of T−1.

e) Show that the logarithm of the absolute value of the determinant ofthe matrix A is given by

log |A| =N−1∑

n=0

log |λn| .

where |A| denotes the absolute value of the determinant of A.

f) Show that in the limit at N →∞,

limN→∞

1

Nlog |A| = 1

∫ π

−πlog |H(ω)|dω .

where H(ω) =∑∞

n=0 hne−jωn is the DTFT of hn.

8. Let Xm,n be a zero-mean 2-D AR Gaussian random process with hm,n =ρδm−1δn + ρδmδn−1 − ρ2δm−1δn−1 and prediction variance σ2.

a) Calculate an expression for E[

|Xm,n|2]

, and determine the value of σ2

so that E[

|Xm,n|2]

= 1.

b) Analytically calculate SX(µ, ν), the power spectrum of X.

c) Use Matlab to generate a 512× 512 sample of X. Use the value of σ2

from a) so that E[

|Xm,n|2]

= 1, and use ρ = 0.9.

d) Use the Matlab command imagesc() to display X as an image.

e) Repeat part c) for ρ = 0.5 and ρ = 0.98.

f) Plot SX(µ, ν) for ρ = 0.9.

9. Consider a 2-D LTI system with input xm,n, output, ym,n, and impulse re-sponse, hm,n, so that ym,n = hm,n∗xm,n, where ∗ denotes 2-D convolution.Also define the vectors, y = [y1,1, · · · , y1,N , y2,1, · · · , y2,N , · · · , yN,1, · · · , yN,N ]

t,

Page 72: Model Based Image Processing (Text)

62 Causal Gaussian Models

and x = [x1,1, · · · , x1,N , x2,1, · · · , x2,N , · · · , xN,1, · · · , xN,N ]t. Show that if

xm,n = 0 for m < 1 or m > N or n < 1 or n > N , then

y = Ax

where A is a Toeplitz block Toeplitz matrix.

10. The following problem builds on the results of Example 3.2. Let Xs

be a zero-mean stationary 2-D Gaussian random process and let S =s = (s1, s2) : for 1 ≤ s1, s2,≤ N. Define, the augmented vector

Vs =

[

Xs

Zs

]

where Zs is as defined in Example 3.2. Then we can defined an aug-mented covariance matrix as

C ,1

N 2

s∈SVsV

ts =

[

σ2x bt

b R

]

.

where, again, σ2x, b, and R are defined as in Example 3.2. Furthermore,

define the expected covariance matrix

C , E

[

C]

a) Show that the MMSE causal prediction filter, h, and prediction vari-ance, σ2

C , can be computed from the entries of the matrix C; and deter-mine an explicit expressions for h from the entries of C.

b) Show C is a matrix with Toeplitz blocks.

c) Show that the matrix C can be specified by knowing the values of thespace autocovariance function R(k, l) = E

[

X(m,n)X(m−k,n−l)]

.

d) Specify exactly the set of values of (k, l) for which you need to deter-mine R(k, l) in order to construct the Toeplitz block Toeplitz matrix C

for P = 2.

e) Remembering that R(k, l) = R(−k,−l), determine the number ofdistinct autocovariance values that are needed to construct the matrixC for P = 2.

Page 73: Model Based Image Processing (Text)

3.5 Chapter Problems 63

f) Determine the number of parameters in a 2-D AR model of orderP = 2.

g) Is the number of distinct autocovariance values determined in part e)equal to the number of AR model parameters in part f)?

h) Use the same methodology to determine the number of distinct au-tocovariance values and the number of AR model parameters for a 1-DAR process of order P = 2. Are these numbers equal?

i) What are the possible consequences of the mismatch in the numberof model parameters and number of distinct autocovariance values for a2-D AR model?

Page 74: Model Based Image Processing (Text)

64 Causal Gaussian Models

Page 75: Model Based Image Processing (Text)

Chapter 4

Non-Causal Gaussian Models

One disadvantage of AR processes is that their construction depends on acausal ordering of points in time. For many applications, it is completelyreasonable to order points into the future, present, and past. For example, inreal-time processing of audio signals, this is a very natural organization of thedata. But sometimes, measurements have no natural ordering. For example,the temperatures measured along a road, are a 1-D signal, but the directionof causality is not well defined. Which end of the road should represent thepast and which the future?

While this example may seem a bit contrived, the problem of orderingpoints becomes much more severe for pixels in an image. In practical imagingapplications, such as video communications, it is often necessary to impose araster ordering on pixels in an image, but subsequent 1-D processing of theordered pixels is likely to produce artifacts aligned with the raster pattern.

The problem becomes even worse when the collected data has no regularstructure. For example, the height of each person in an organization can beviewed as a random quantity to be modeled, but what 1-D ordering of peoplein an organization is appropriate? In this case, the set of data points doesnot even naturally lie on a 2-D or higher dimensional grid.

The objective of this section is to introduce the basic tools that we willneed to remove causality from the modeling of images and other data. Forimages, these techniques will help us to avoid the creation of artifacts; butmore generally, these techniques can serve as powerful tools for the modelingof a wide variety of data that can be represented on regular grids or graphs.

Page 76: Model Based Image Processing (Text)

66 Non-Causal Gaussian Models

Xn-2 Xn-1 Xn Xn+1 Xn+2Xn-3 Xn+3

G(ejω)+

-

en

Figure 4.1: Diagram of a non-causal predictor for a P th order 1-D Gaussian Markovrandom field. The linear time-invariant prediction filter, gn, is symmetric and hasfrequency response, G(ω). In this case, the resulting prediction errors, En, are notwhite when the predictor is optimal.

4.1 Non-Causal Prediction in Gaussian Models

In order to introduce the concepts of modeling with non-causal prediction, wewill start with the case of 1-D signals. Let X1, · · · , XN again be a zero-meandiscrete-time Gaussian random process. Rather than use causal prediction,we will attempt to model Xn using predictions based on a combination ofpast and future information. In this case, the MMSE predictor is given by

Xn = E[Xn|Xi for i 6= n] .

As with the causal predictor, the non-causal predictor is a linear functionof the data when the random process is zero-mean and Gaussian. So thenon-causal prediction error can be written as

En = Xn −N∑

i=1

gn,iXi

where gn,n = 0 for all 1 ≤ n ≤ N . This condition that gn,n = 0 is veryimportant. Otherwise, the value Xn would be used to predict Xn perfectly!In addition, we define σ2

n to be the non-causal prediction variance given by

σ2n = E

[

E2n|Xi for i 6= n]

.

Notice that because Xn is jointly Gaussian, we know from Property 2.5 thatthe prediction variance is not a function of Xi for i 6= n; however, it maydepend on the time index, n.

As in the case of causal predictors, non-causal predictors have a number ofimportant properties. First, the non-causal prediction errors are independentof the values used in prediction.

Page 77: Model Based Image Processing (Text)

4.2 Density Functions Based on Non-Causal Prediction 67

Property 4.1. Independence of non-causal Gaussian prediction errors frompast and future - The MMSE non-causal prediction errors for a zero-meanGaussian random process are independent of the past and future of the ran-dom process.

En ⊥⊥ Xii 6=n .

Unfortunately, one very important property is lost when using non-causalprediction. In general, the non-causal prediction errors are no longer uncor-related and independent. This is a great loss because the independence of thecausal prediction errors was essential for the computation of the probabilitydensity of the random process in Section 3.2.

4.2 Density Functions Based on Non-Causal Predic-

tion

Although the non-causal prediction errors are not independent, we will stillbe able to calculate the probability density for Xn by using vector-matrixoperations, but with a somewhat different strategy. Since X is a zero-meanGaussian random vector, it must have a density function with the form

p(x) =1

(2π)N/2|B|1/2 exp

−12xtBx

, (4.1)

where B is the inverse of the covariance matrix for X. The matrix B isoften called the precision matrix since as it grows large, the variance of Xtends to become small. Furthermore, we know that since X is a zero-meanGaussian vector, we can write the conditional distribution of Xn given all theremaining Xi for i 6= n as

p(xn|xi for i 6= n) =1

2πσ2n

exp

− 1

2σ2n

(

xn −N∑

i=1

gn,ixi

)2

(4.2)

where σ2n is the non-causal prediction variance for Xn, and gn,i are the MMSE

non-causal prediction coefficients.

Our objective is then to determine the matrix B in terms of the non-causal prediction parameters σ2

n and gn,i. We can derive this relationship by

Page 78: Model Based Image Processing (Text)

68 Non-Causal Gaussian Models

differentiating the log likelihood as follows.

d

dxnlog p(x) =

d

dxnlog p(xn|xi for i 6= n)p(xi for i 6= n)

=d

dxnlog p(xn|xi for i 6= n) +

d

dxnlog p(xi for i 6= n)

=d

dxnlog p(xn|xi for i 6= n)

Next, we can evaluate the left and right hand sides of this equality by dif-ferientiating the expressions of (4.1) and (4.2) to yield the following newrelationship.

N∑

i=1

Bn,ixi =1

σ2n

(

xn −N∑

i=1

gn,ixi

)

Since this equality must hold for all x and all n, the inverse covariance matrix,B, must then be given by

Bi,j =1

σ2i

(δi−j − gi,j) .

Alternatively, we can invert this relationship to compute the MMSE non-causal predictor parameters given a specification of B.

σ2n = (Bn,n)

−1

gn,i = δn−i − σ2nBn,i .

These two relationships can be more compactly represented using matrixnotation. If we define the matrix Gi,j = gi,j as the non–causal predictionmatrix, Γ = diag

σ21, · · · , σ2

N

as the diagonal matrix of non-causal predic-tion variances, and E as the column vector of non-causal prediction errors,then we have that E = (I −G)X, and

B = Γ−1(I −G)

or alternatively

Γ = diag(B)−1

G = I − ΓB .

Page 79: Model Based Image Processing (Text)

4.3 1-D Gaussian Markov Random Fields (GMRF) 69

4.3 1-D Gaussian Markov Random Fields (GMRF)

An important special case occurs when the number of observations needed todetermine the MMSE non-causal predictor is limited to a window of n ± Pabout the point being predicted. In order to simplify the notation, we definethe window

∂n = i ∈ [1, · · · , N ] : i 6= n and |i− n| ≤ P ,

so that ∂n is a set containing P neighbors on either side of n, except on theboundary, where it is truncated.

Using this new notation, a 1-D Gaussian Markov random field (GMRF)1

is any Gaussian random process with the property that

E[Xn|Xi for i 6= n] = E[Xn|Xi for i ∈ ∂n] .

In words, the MMSE non-causal predictor for any pixel in an GMRF is onlydependent on the pixel’s neighbors. Figure 4.2 illustrates the structure of theprediction window for a 1-D GMRF of order P .

The GMRF is a bit like an AR process, but the causal predictor of the ARprocess is replaced with a non-causal predictor in the GMRF. For the mostgeneral case of a zero-mean GMRF, the non-causal prediction error then hasthe form

En = Xn −∑

i∈∂ngn,iXi .

In order to reduce the number of model parameters, it is often useful toassume that the prediction coefficients are not a function of position, n. Thisresults in the following new definition.

Definition 5. Homogeneous GMRFA GMRF is said to be homogeneous if both the MMSE non-causalpredictor and MMSE prediction variance are invariant to position.

The MMSE non-causal prediction error for a homogeneous GMRF then

1 We should note that the terminology “1-D random field” is clearly an oxymoron, since the term “randomfield” refers to a 2-D object. Later we will see that the concept of a Markov random field (MRF) grew outof the study of 2 or more dimensional objects, where they are most useful, but the concept applies perfectlywell to 1-D also.

Page 80: Model Based Image Processing (Text)

70 Non-Causal Gaussian Models

has the formEn = Xn −

i∈∂ngn−iXi ,

with the non-causal prediction variance, σ2NC , taking on a constant value. In

this case, we can write the density function for the homogeneous GMRF as

p(x) =1

(2π)N/2|B|1/2 exp

−12xtBx

,

where

Bi,j =1

σ2NC

(δi−j − gi−j) .

Since we know that B must be a symmetric matrix, this implies that gn = g−nmust be a symmetric filter.

Once again, if we extend Xn so that n = −∞, · · · ,−1, 0, 1, · · · ,∞, thenwe can express the relation between Xn and the non-causal prediction errors,En, using convolution.

En = Xn ∗ (δn − gn) (4.3)

andXn = En +

i∈∂ngn−iXi .

Using this expression, we can compute the covariance between En and Xn as

E[EnXn] = E

[

En(

En +∑

i∈∂ngn−iXi

)]

= E[

E2n]

+∑

i∈∂ngn−iE[EnXi]

= E[

E2n]

+ 0 = σ2NC .

By combining this result with Property 4.1, we get the following expressionfor the covariance between the prediction error and Xn.

E[EnXn+k] = σ2NCδk .

This result just indicates that the prediction errors are independent of thevalues used in the prediction. Using this fact, we have that

σ2NCδk = E[EnXn+k]

Page 81: Model Based Image Processing (Text)

4.3 1-D Gaussian Markov Random Fields (GMRF) 71

= E

En

En+k +∑

i∈∂(n+k)

gn+k−iXi

= E[EnEn+k] +∑

i∈∂(n+k)

gn+k−iE[EnXi]

= RE(k) +∑

i∈∂(n+k)

gn+k−iσ2NCδi−n

= RE(k) + σ2NCgk .

Rearranging terms results in

RE(n) = σ2NC (δn − gn) , (4.4)

where RE(n) is the time autocovariance of the non-causal prediction errors.So from this we see that, in general, the noncausal prediction errors are notwhite. From equation (4.3) and problem 21 of Chapter 2, we know thatautocovariance functions for En and Xn must be related by

RE(n) = RX(n) ∗ (δn − gn) ∗ (δn − g−n) . (4.5)

Equating the expressions of (4.4) and (4.5), we get that

σ2NC (δn − gn) = RX(n) ∗ (δn − gn) ∗ (δn − g−n) .

Then taking the DTFT of this equation we get that

σ2NC (1−G(ω)) = SX(ω) (1−G(ω))2 , (4.6)

where G(ω) is the DTFT of gn, and SX(ω) is the power spectrum ofXn. Fromequations (4.4) and (4.6), we can compute the power spectral density of boththe homogeneous GMRF process and its associated non-causal predictionerrors,

SX(ω) =σ2NC

1−G(ω)(4.7)

SE(ω) = σ2NC (1−G(ω)) , (4.8)

and by taking the inverse DTFT of equations (4.7), we can derive an expres-sion for the autocorrelation function of the random process Xn.

RX(n) ∗ (δn − gn) = σ2NCδn . (4.9)

Page 82: Model Based Image Processing (Text)

72 Non-Causal Gaussian Models

4.4 2-D Gaussian Markov Random Fields (GMRF)

In fact, all of the derivations of this section are easily generalized to regulargrids in 2 or more dimensions. To do this, each lattice point is represented bys = (s1, s2), where s is a vector index with each coordinate taking on values inthe range 1 to N . We denote the set of all lattice points as S = 1, · · · , N2.

To generalize the vector-matrix relationships, we can order the pixels ofthe vector X in raster order so that

X = [X1,1, · · · , X1,N , X2,1, · · · , X2,N , · · · , XN,1, · · · , XN,N ]t ,

and E is ordered similarly. If the GMRF is homogeneous, then the 2-Dnoncausal prediction error is again given by

Es = Xs −∑

r∈∂sgs−rXr ,

where ∂s is a set of neighbors in 2-D. Typically, this set is given by

∂s = r = (r1, r2) : r 6= s and |r1 − s1| ≤ P and |r2 − s2| ≤ P ,

where P defines a (2P+1)×(2P+1) window about the point being predicted.Figure 4.2 illustrates the structure of this 2-D prediction window for an orderP GMRF.

Again, the prediction errors can be expressed in matrix form as

E = (I −G)X ,

where G is the 2-D prediction matrix. As in the case of the 2-D AR model,the matrix G is Toeplitz block Toeplitz.

The 2-D stationary GMRF also has properties quite similar to the 1-Dcase. In fact, the results are formally identical, only with 1-D convolutionbeing replaced by 2-D convolution and the 1-D DTFT being replaced by the2-D DSFT. More specifically,

RE(s) = σ2NC (δs − gs) (4.10)

RX(s) ∗ (δs − gs) = σ2NCδs , (4.11)

where ∗ denotes 2-D convolution of 2-D functions. From this we can expressthe 2-D power spectral density of both the homogeneous GMRF process and

Page 83: Model Based Image Processing (Text)

4.5 Relation Between GMRF and Gaussian AR Models 73

• • ⊗ • •

• • • • •• • • • •• • ⊗ • •• • • • •• • • • •

1-D GMRF order P = 2 2-D GMRF order P = 2

Figure 4.2: Structure of 1-D and 2-D GMRF prediction window for an order P = 2model. The pixel denoted by the symbol ⊗ is predicted using both the past andfuture values denoted by the symbol •. For the 1-D case, 2P = 4 values are used asinput to the predictor, and for the 2-D case, (2P + 1)2 − 1 = 24 values are used bythe predictor.

its associated prediction errors as

SX(µ, ν) =σ2NC

1−G(µ, ν)(4.12)

SE(µ, ν) = σ2NC (1−G(µ, ν)) , (4.13)

where G(µ, ν) is the DSFT of gs.

4.5 Relation Between GMRF and Gaussian AR Mod-

els

An obvious question that arises at this point is which model is more general,the AR or GMRF? In other words, is an AR model a GMRF, or vice versa? Inorder to answer this question, we can relate the autocovariance functions andpower spectra for stationary AR and GMRF models. Table 4.1 summarizesthe important relationships from the previous chapter.

We know that if the autocovariance of the stationary AR and GMRFprocesses are the same, then they must have the same distribution. Equa-tions (3.9) and (4.9) give equations that specify the 1-D autocovariance forthe AR and GMRF cases, respectively. So if we assume that RX(n) is thesame in both expression, then we can combine these two equations to derivethe following relationship.

RX(n) ∗ (δn − gn) σ2C = RX(n) ∗ (δn − hn) ∗ (δn − h−n)σ

2NC

From this, we see that the equality will be satisfied if the following relationship

Page 84: Model Based Image Processing (Text)

74 Non-Causal Gaussian Models

1-D AR Model 1-D GMRF ModelModelParameters

σ2C , hn σ2

NC , gn

Time Auto-correlation

RX(n) ∗ (δn − hn) ∗ (δn − h−n) = σ2Cδn RX(n) ∗ (δn − gn) = σ2

NCδn

PowerSpectrum

SX(ω) =σ2C

|1−H(ω)|2 SX(ω) =σ2NC

1−G(ω)

2-D AR Model 2-D GMRF ModelModelParameters

σ2C , hs σ2

NC , gs

Space Auto-correlation

RX(s) ∗ (δs − hs) ∗ (δs − h−s) = σ2Cδs RX(s) ∗ (δs − gs) = σ2

NCδs

PowerSpectrum

SX(µ, ν) =σ2C

|1−H(µ, ν)|2 SX(µ, ν) =σ2NC

1−G(µ, ν)

Table 4.1: Autocovariance and power spectrum relationships for 1-D and 2-D Gaus-sian AR and GMRF models.

holds between the parameters of the AR and GMRF models.

σ2C(δn − gn) = σ2

NC(δn − hn) ∗ (δn − h−n) (4.14)

So if we are given a specific AR process, then we can compute the pa-rameters of an equivalent GMRF process using equation (4.14) above. Inparticular, if we evaluate the equation for n = 0, we get the following generalrelationship between the causal and non-causal prediction error.

σ2NC =

σ2C

1 +∑P

n=1 h2n

(4.15)

Using this relationship, we have that

gn = δn −(δn − hn) ∗ (δn − h−n)

1 +∑P

n=1 h2n

. (4.16)

So if we select an order P AR model, then the resulting GMRF predictioncoefficients of equation (4.16) are given by the time autocorrelation of thefunction δn − hn.

2 This autocorrelation operation is shown graphically inFigure 4.3. Notice, that in 1-D, an order P AR model results in an order P

2The autocorrelation of a function fn is defined as fn ∗ f−n, i.e. the convolution with its time reverse.

Page 85: Model Based Image Processing (Text)

4.5 Relation Between GMRF and Gaussian AR Models 75

GMRF. You should be able to convince yourself of this by working out thesimple case when P = 2.

In order to find the parameters of an AR model from the parameters ofa GMRF, it is necessary to find a causal predictor, hn, so that (4.14) holdsin either 1-D or 2-D. In the 1-D case, this is a classic problem that has beensolved for the case of Wiener filtering. Because gn is a symmetric function, itis always possible to factor its rational Z-transform into a product of causaland anti-causal parts. However, this result can not be generalized to 2-Dbecause polynomials in more than one dimension can not, in general, befactored. This leads to the following result.

Property 4.2. Equivalence of AR and GMRF models in 1-D - A stationarydiscrete time zero-mean Gaussian random process is a 1-D order P AR modelif and only if it is 1-D order P GMRF.

Surprisingly, this equivalence relationship does not hold in 2-D. First, Fig-ure 4.3 shows how a 2-D AR model of order P produces a 2-D GMRF oforder 2P . This is because the resulting 2-D convolution of the predictionfilter produces an oblong function which is 4P + 1 wide and 2P + 1 high.However, the converse relationship simply no longer holds. That is to saythat 2-D GMRFs simply are not (in general) 2-D AR processes.

Property 4.3. In 2-D, an AR model of order P is a GMRF of order 2P - In2-D, a stationary discrete time zero-mean order P AR model is also an order2P GMRF.

Figure 4.4 summarizes the situation with a Venn diagram that illustratesthe relationship between AR processes and GMRFs in 1 and 2-D. So from thiswe see that GMRFs are more general than AR models in 2-D, but not in 1-D.This explains why they are called Gaussian Markov random fields! They grewout of a theory which was motivated by needs in 2 or more dimensions becauseGMRFs are more general only in 2 or more dimensions. In practice, thismeans that 2-D GMRFs can be used to model a broader class of distributions,which is a major justification for their use.

Example 4.1. Consider a zero-mean stationary AR process with order P = 1,and prediction filter

hn = ρδn−1 ,

Page 86: Model Based Image Processing (Text)

76 Non-Causal Gaussian Models

• • ⊗ ⇒ 1-D Autocorrelation ⇒ • • ⊗ • •

1-D AR order P = 2 1-D GMRF order P = 2

• • • • •• • • • •• • ⊗

⇒ 2-D Autocorrelation ⇒

• • • • • • •• • • • • • • • •• • • • ⊗ • • • •• • • • • • • • •• • • • • • •

2-D AR order P = 2Requires 2-D GMRF

of order 2P = 4

Figure 4.3: Relationship between an AR model and the corresponding GMRF inboth 1-D and 2-D. In both 1-D and 2-D, the GMRF prediction window is producedby the autocorrelation of the AR filter. Notice that in 1-D, an order P AR modelproduces an order P GMRF. However, in 2-D an order P AR model produces aGMRF which requires an order of 2P . In each case, the pixels denoted by the symbol⊗ are predicted using the values denoted by the symbol •.

where |ρ| < 1, and prediction variance σ2C .

From this AR model, we would like to calculate the parameters of anequivalent GMRF. The non-causal prediction variance is given by

σ2NC =

σ2C

1 + ρ2.

Notice, that this non-causal prediction variance is always smaller than thecausal prediction variance. The corresponding non-causal prediction filter isgiven by

gn = δn −(δn − hn) ∗ (δn − h−n)

1 + ρ2

1 + ρ2(δn−1 + δn+1) .

From this we can also calculate the power spectrum for both the AR andGMRF processes as

SX(ω) =σ2C

|1−H(ω)|2=

σ2C

|1− ρe−jω|2

Page 87: Model Based Image Processing (Text)

4.6 GMRF Models on General Lattices 77

2−D GMRF: order 2P

1−D AR: order P1−D GMRF:order PRandom Processes

Gaussian

2−D GMRF: order P2−D AR: order P

Figure 4.4: Venn diagram illustrating the relationship between AR and GMRF modelsin 1 and 2-D among the set of all Gaussian random processes. Notice that in 1-D,AR and GMRF models are equivalent, but in 2-D they are not.

=σ2C

(1 + ρ2)

1(

1− 2ρ1+ρ2 cos(ω)

) ,

or equivalently using the GMRF power spectrum

SX(ω) =σ2NC

1−G(ω)=

σ2NC

1− g1e−jω − g1ejω

=σ2NC

1− 2g1 cos(ω)

=σ2C

(1 + ρ2)

1(

1− 2ρ1+ρ2 cos(ω)

) .

This verifies that the two models result in the same power spectral density.

4.6 GMRF Models on General Lattices

Now that we have seen the GMRF in 1 and 2-D, we can take a slightly moreabstract approach and develop a general formulation of the GMRF which isapplicable to observations indexed on any lattice. To do this, we consider arandom process, Xs, indexed on a finite set of lattice points s ∈ S.

Page 88: Model Based Image Processing (Text)

78 Non-Causal Gaussian Models

The neighbors of a pixel, s, are again denoted by ∂s, but we have made nospecific assumptions regarding the structure of S, or the neighbors of a pixel,∂s. In fact, our specification of neighbors must only meet the two constraintsstated in the following definition.

Definition 6. Neighborhood SystemFor each s ∈ S, let ∂s ⊂ S. Then we say that ∂s is a neighborhoodsystem if it meets two conditions. First, for all s ∈ S, s 6∈ ∂s. Second,for all s, r ∈ S, if s ∈ ∂r, then r ∈ ∂s.

So for ∂s to be a legitimate neighborhood system, s can not be a neigh-bor of itself, and if s is a neighbor of r, then r must be a neighbor of s.Cliques are another very important concept that are very closely related toneighborhoods.

Definition 7. Pair-Wise CliqueAn unordered pair of pixels s, r with s, r ∈ S is said to be a pair-wiseclique if s ∈ ∂r. We denote the set of all pair-wise cliques as

P = s, r : s ∈ ∂r such that s, r ∈ S .

Notice that by convention, the pixel pair s, r is unordered, so each uniquepair only appears once in the set P . Using this concept of neighbors, we maygive a formal definition for a Gaussian Markov random field (GMRF).

Definition 8. Gaussian Markov random field (GMRF)Let Xs be a jointly Gaussian random process indexed on s ∈ S. Thenwe say that X is a Gaussian Markov random field (GMRF) with neigh-borhood system ∂s, if for all s ∈ S

E[Xs|Xr for r 6= s] = E[Xs|Xr for r ∈ ∂s] .

So a GMRF is a Gaussian random process Xs such that the non-causalpredictor is only dependent on neighboring values, Xr for r ∈ ∂s. Using thisnew and somewhat more general formulation, we can restate the results ofSection 4.2 that relate the non-causal prediction parameters of a zero-meanGMRF to the parameters of its density function. So the equations of non-

Page 89: Model Based Image Processing (Text)

4.6 GMRF Models on General Lattices 79

causal prediction become

Es = Xs −∑

r∈∂sgs,rXr

σ2s = E

[

E2s |Xr for r ∈ ∂s]

or in vector-matrix form this is written as

E = (I −G)X

Γ = diag(

E[

EE t])

.

With this notation, we can define the following general property of zero-meanGMRFs.

Property 4.4. Density of a zero-mean GMRF from non-causal prediction pa-rameters - The density function of a zero-mean Gaussian random process,Xs for s ∈ S, with non-causal prediction matrix G and positive-definite non-causal prediction variance matrix, Γ, is given by

p(x) =1

(2π)N/2|B|1/2 exp

−12xtBx

,

where the inverse covariance, B, is given by

B = Γ−1(I −G) ,

or equivalently, the non-causal prediction parameters are given by

Γ = diag(B)−1

G = I − ΓB .

These relationships can also be written more explicitly as

Bs,r =1

σ2s

(δs−r − gs,r)

σ2s =

1

Bs,s

gs,r = δs−r − σ2sBs,r .

Page 90: Model Based Image Processing (Text)

80 Non-Causal Gaussian Models

4.7 Chapter Problems

1. Property 3.3 applies to causal prediction errors for zero-mean Gaussianrandom processes. Is the same property true for non-causal predictionerrors in which Xi = E[Xi|Xk k 6= i]? If not, what step in the proof ofProperty 3.3 no longer holds for non-causal prediction?

2. Let Xn be a 1-D zero-mean stationary Gaussian AR process with MMSEcausal prediction filter given by hn = ρδn−1 and causal prediction vari-ance σ2

c . Calculate (σ2NC , gn) the noncausal prediction variance and the

noncausal prediction filter for the equivalent GMRF.

3. Let Xn5n=1 be a zero-mean 1-D order 2 GMRF.

a) A friend tells you that the non-causal prediction variance for Xn isσ2n = n and non-causal prediction filter is gn = 1

4(δn−1 + δn+1). Is thispossible? If so, why? If not, why not?

b) If you know that

Bn,m =√nm

(

δn−m −1

4(δn−m−1 + δn−m+1)

)

,

then calculate the non-causal prediction variance σ2n and the non-causal

prediction filter gm,n for X.

4. Let Xn be a zero-mean stationary GMRF with prediction filter gn andprediction variance σ2

NC . Can gn be any symmetric function? If not,what properties must gn have?

5. Let Xn be a zero-mean stationary 1-D Gaussian MRF with noncausalpredictor gn. Prove that

n gn < 1.

6. Let G(ω) be the DTFT of the non-causal prediction filter, gn, for a zero-mean stationary GMRF. Prove that G(ω) is real valued, with G(ω) ≤ 1.

7. Let Xm,n be a 2-D zero-mean wide-sense stationary random process withautocovariance function R(k, l) = E[Xm,nXm+k,n+l].a) Show that ∀k, l, R(k, l) = R(−k,−l)b) Give an example of a wide sense stationary random process for whichit is false that ∀k, l, R(k, l) = R(−k, l). (Hint: This is equivalent to ∃k, l,R(k, l) 6= R(−k, l).)

Page 91: Model Based Image Processing (Text)

4.7 Chapter Problems 81

8. Let Xs be a zero-mean 2-D Gaussian AR process indexed by s = (s1, s2),and let the MMSE causal prediction filter be given by

hs = ρδs1−1,s2 + ρδs1,s2−1

and the causal prediction variance be given by σ2C . Determine (σ2

NC , gs)the noncausal prediction variance and the noncausal prediction filter.

9. Let Xs be a zero-mean GMRF on a finite general lattice s ∈ S. Let Xbe a vector of dimension N = |S| containing all the elements of Xs insome fixed order, and denote the inverse covariance of X as

B =(

E[

XX t])−1

.

a) Write an expression for p(x), the PDF of X in terms of B.

b) If ∂s denotes the neighborhood system of the MRF, then show thatif r 6∈ ∂s and r 6= s, then Br,s = Bs,r = 0.

c) Show that we can define a valid (but possibly different) neighborhoodsystem for this GMRF as

∂s = r ∈ S : Br,s 6= 0 and r 6= s .

10. Let Xs be a zero-mean GMRF on a finite general lattice s ∈ S withneighborhood system ∂s. Let X be a vector of dimension N = |S|containing all the elements of Xs in some fixed order. Furthermore, letG be the N ×N non-causal prediction matrix and let Γ be the diagonalmatrix of non-causal prediction variances.

a) Determine the inverse covariance matrix, B, in terms of G and Γ.

b) Give conditions on G and Γ that ensure that they correspond to avalid GMRF with neighborhood system ∂s.

11. Let X(k)s be a zero-mean GMRF on a finite general lattice s ∈ S with

neighborhood system ∂s. Assume the X∂s is a vector of fixed dimensionP for all s ∈ S. Furthermore, assume that the GMRF is homogeneousso that

Xs , E[Xs|X∂s] = X t∂sh

σ2 , E

[

(Xs − Xs)2|X∂s

]

Page 92: Model Based Image Processing (Text)

82 Non-Causal Gaussian Models

where h is a vector of prediction filter coefficients and σ2 is the non-causalprediction variance.

a) Determine an expression for the ML estimate of the model parameters(h, σ2). Is the expression in closed form? If not, what are the differencesbetween the GMRF and the Gaussian AR model that make this MLestimate more difficult to calculate in closed form?

b) Is it true that

p(x)?=∏

s∈Sps(xs|x∂s)

where ps(xs|x∂s) is the conditional distribution of Xs given X∂s? Howdoes this differ from the case of an AR model?

c) Define the log pseudo-likelihood as

PL(h, σ2) ,∑

s∈Slog ps(xs|x∂s, h, σ2) ,

and define the maximum pseudo-likelihood estimate of (h, σ2) as

(h, σ2) = arg max(h,σ2)

PL(h, σ2) .

Derive a closed form expression for the maximum pseudo-likelihood es-timate in this case.

Page 93: Model Based Image Processing (Text)

Chapter 5

MAP Estimation with GaussianPriors

Model-based signal processing is not just about accurately modeling data. Itis about using these models to extract desired information from the availabledata. In this chapter, we will introduce the MAP estimator as a generalapproach to achieving this goal. In order to illustrate the concepts, we willconsider the specific application of the restoration of a blurred and noisyimage. However, the framework we introduce is quite general, and can serveas the bases for the solution of any linear or non-linear inverse problem.

The MAP estimator depends on the selection of a forward and prior model.In our example, the forward model characterizes the blurring and noise pro-cesses that corrupt the measured image. The prior model provides a frame-work to incorporate available information about the likely behavior of theimage to be restored.

We will use the GMRF of the the previous chapter as a prior model since itis tractable and provides valuable insight. However, we will also see that thesimple GMRF prior model has a number of practical shortcomings that limitits value in real applications. Perhaps its most important shortcoming is thatthe GMRF does not properly model the discontinuous edges that occur in realimage data, so the associated restorations tend to be overly smooth. Luckily,this deficiency can be addressed by the non-Gaussian MRFs introduced inthe next chapter.

Page 94: Model Based Image Processing (Text)

84 MAP Estimation with Gaussian Priors

5.1 MAP Image Restoration

Image and signal processing problems often have a common structure. Typ-ically, there is some type of observed data, Y , from which one must try todetermine some unknown image or signal X. Often, Y might be the datafrom one or more cameras or other sensors, and X might be the “true” stateof the world that is of interest. For example, in medical applications, X mayrepresent noiseless and undistorted measurements of 3-D tissue properties,and Y might be tomographic measurements of X-ray projections or magneticresonance signals.

In these problems, Bayes’ rule can be used to reform the expression forthe MAP estimate of equation (2.11).

xMAP = argmaxx∈Ω

log px|y(x|y)

= argmaxx∈Ω

log

(

py|x(y|x)px(x)py(y)

)

= argmaxx∈Ω

log py|x(y|x) + log px(x)− log py(y)

Since the term log py(y) does not depend on x, this term can be drop fromthe optimization resulting in the canonical expression for the MAP estimate.

xMAP = argminx∈Ω

− log py|x(y|x)− log px(x)

(5.1)

In this expression, we will refer to py|x(y|x) as the forward model since itquantifies how the observed data Y depends on the unknown X. Importantly,the forward model describes how changes in X can effect both the meanand the statistical distribution of observations Y . We refer to px(x) in thesecond term as the prior model. The prior model quantifies what we knowabout the likely properties of the solution even before we have made anymeasurements. So for example, a medical image should not look like randomnoise. With very high probability, it should have local smoothness propertiesand structure that is consistent with known medical image cross-sections.

From the form of equation (5.1), we can see that the MAP estimaterepresents a balance between the minimization of a forward model term,− log py|x(y|x), and a prior model term, − log px(x). Intuitively, the MAP

Page 95: Model Based Image Processing (Text)

5.1 MAP Image Restoration 85

estimate seeks to find the solution that both fits the data accurately, but alsois consistent with our prior knowledge of how the solution should behave.

The MAP estimator is very powerful because it can serve as a frameworkfor solving any problem that requires the estimation of an unknown quan-tity X from observations Y . Problems of this form are known as inverseproblems because they require that the effects of distorting transformationsand noise be reversed. An enormous range of applications in physics, biol-ogy, chemistry, and computer science can be viewed as inverse problems; so ageneral theoretical framework for solving inverse problems is of great value.

In order to make the techniques of MAP estimation and inverse problemsmore clear, we will start with a relatively simple, but still important, problemof restoration of an image or signal X from noisy and blurred data Y . To dothis, let X ∈ R

N be an N pixel image that we would like to measure, and letY ∈ R

N be the noisy measurements given by

Y = AX +W (5.2)

where A is a nonsingular N ×N matrix, and W is a vector of i.i.d. Gaussiannoise with distribution N(0, σ2I).

This type of inverse problem occurs commonly in imaging applicationswhere Y consists of noisy and blurred scanner measurements and X is therestored image that we would like to recover. For example, the matrix Amay represent the blurring operation of a linear space-invariant filter. In thiscase, the elements of Y and X are related by

Ys =∑

r∈SAs−rXr +Ws ,

and if the pixels are organized in raster order, then A is a Toeplitz-block-Toeplitz matrix. In fact, with a little generalization, the model of (5.2)can be used to represent important problems in image reconstruction thatoccur in applications such as tomographic reconstruction or even astronomicalimaging.

Using the model of (5.2), the conditional distribution of Y given X is

py|x(y|x) =1

(2πσ2)N/2exp

− 1

2σ2||y − Ax||2

. (5.3)

Page 96: Model Based Image Processing (Text)

86 MAP Estimation with Gaussian Priors

One approach to recovering X from Y is to use the ML estimate of X givenin Section 2.3.

xML = arg maxx∈RN

log py|x(y|x)

= arg maxx∈RN

− 1

2σ2||y − Ax||2 − N

2log(2πσ2)

= arg minx∈RN

||y − Ax||2

= A−1y

However, this ML solution has a number of problems associated with it.First, if the matrix A is nearly singular, then inversion of A may be unstable.In order to see this, consider the singular value decomposition (SVD)of A given by

A = UΣV t (5.4)

where U and V are orthonormal N×N matrices and Σ = diagσ1, · · · , σN isa diagonal matrix of singular values arranged in monotone decreasing order.Using this decomposition, the ML solution can be expressed as

XML = A−1Y

= X + A−1W

= X + V Σ−1U tW

= X + V Σ−1W ,

where W ∼ N(0, σ2I). So if the the singular values are much smaller thanthe noise variance (i.e., σN << σ), then the inversion process will amplifythe noise in W and render the ML estimate unusable. In fact, this caneasily happen if A represents a blurring filter with a transfer function that isnearly zero or small at certain frequencies. In this case, the matrix inversionis equivalent to amplification of the suppressed frequencies. Of course, thisamplification increases both the signal and the noise in Y , so it will producea very noisy result. Moreover, whenever the ratio of the largest to smallestsingular values is large, inversion of A will be problematic. For this reason,the ML estimate tends to be unstable whenever the condition number ofthe matrix A defined as

κ(A) =

σ1σN

Page 97: Model Based Image Processing (Text)

5.1 MAP Image Restoration 87

is very large. In this case, the dynamic range of the inverse problem canbecome large leading to a wide array of numerical instabilities.

However, even if A = I (the identity matrix) with a condition number of 1,the ML estimate is unsatisfying because it implies that the best restorationof a noisy image is to simply accept the measured noise with no furtherprocessing. Intuitively, we might expect that some type of processing mightbe able to reduce the noise without excessively degrading the image detail.

An alternative approach to the ML estimate is to use the Bayesian es-timator from Section 2.3.2. This approach has the advantage that one canincorporate knowledge about the probable behavior of X through the selec-tion of a prior distribution. For this example we use a zero mean homogeneousGMRF prior model for X, with non-causal prediction matrix Gi,j = gi−j andnon-causal prediction variance σ2

x. This results in a density function for X ofthe form

px(x) =1

(2π)N/2|B|1/2 exp

−12xtBx

(5.5)

where Bi,j =1σ2x(δi−j − gi−j).

Using this assumption, we can compute the posterior distribution px|y(x|y).From Bayes rule, we know that

log px|y(x|y) = log py|x(y|x) + log px(x)− log py(y) .

However, this expression is difficult to evaluate directly because calculationof the term py(y) requires the evaluation of a difficult integral. Therefore, wewill take a different tack, and simply evaluate log px|y(x|y) as a function of x,ignoring any dependence on y. This means that our solution will be correctwithin an unknown additive constant, but we can compute that constantif needed because we know that px|y(x|y) must integrate to 1. So usingexpressions (5.3) and (5.5), we have that

log px|y(x|y) = −1

2σ2||y − Ax||2 − 1

2xtBx+ c(y) (5.6)

where c(y) is some as yet unknown function of y. Since (5.6) is a quadraticfunction of x, we can complete-the-square and express this function in thestandard quadratic form

log px|y(x|y) = −1

2(x− µ(y))tR−1(x− µ(y)) + c′(y) (5.7)

Page 98: Model Based Image Processing (Text)

88 MAP Estimation with Gaussian Priors

where µ(y) and R are given by

µ(y) =(

AtA+ σ2B)−1

Aty

R =

(

1

σ2AtA+B

)−1,

and again c′(y) is only a function of y. From the form of (5.7), we know thatpx|y(x|y) must be conditionally Gaussian, with a conditional mean of µ(y)and conditional variance of R. Therefore, the conditional density must havethe form

px|y(x|y) =1

(2π)N/2|R|−1/2 exp

−12(x− µ(y))tR−1(x− µ(y))

. (5.8)

Using the posterior distribution of (5.8), we can compute some typicalBayesian estimators. Notice that the MMSE estimator is given by the con-ditional mean,

xMMSE = E [X|Y = y] = µ(y) ,

and the MAP estimate is given by the conditional mode

xMAP = arg maxx∈RN

log pX|Y (x|y)

= arg minx∈RN

1

2(x− µ(y))tR−1(x− µ(y))

= µ(y) .

Notice that for this case, the MMSE and MAP estimates are the same. Infact, this is always the case when all the random quantities in an estimationproblem are jointly Gaussian. However, we will find that the MMSE andMAP are generally not the same when the distributions are non-Gaussian.This will be important later since we will see that non-Gaussian distributionsare better models for image features such as edges.

5.2 Computing the MAP Estimate

So it seems that our problem is solved with the ubiquitous estimate

x =(

AtA+ σ2B)−1

Aty . (5.9)

Page 99: Model Based Image Processing (Text)

5.3 Gradient Descent Optimization 89

However, while the solution of (5.9) is mathematically appealing it is notvery practical for most applications because the dimension of the matrix tobe inverted is enormous. For example, if N equals 1 million pixels, then thematrix to be inverted has 1012 elements. If the matrix is dense and eachelement is stored with a 64 bit float, then it will require approximately 8terrabytes of storage! So, clearly we will need another approach.

In order to make the computation of the MAP estimate more tractable,we must go back to the first principles of its derivation. The MAP estimateof X given Y is given by the optimization of equation (5.1). So substitutingthe expressions from (5.3) and (5.5) into (5.1), yields the equation

xMAP = arg minx∈RN

1

2σ2||y − Ax||2 + 1

2xtBx

. (5.10)

From equation (5.10), we see that, in this case, MAP estimation is equivalentto minimization of a quadratic function of the form

f(x) =1

2σ2||y − Ax||2 + 1

2xtBx . (5.11)

The key insight is that while the direct inversion of (5.9) provides an exactmathematical solution, it requires an enormous amount of computation toevaluate. Alternatively, numerical optimization methods can provide an ap-proximate solution to the minimization of (5.10) that can be computed muchmore efficiently.

In the following sections, we present four typical methods for solving thisoptimization problem. While many other methods exist, these methods areselected to provide canonical examples of the strengths and weaknesses ofvarious optimization approaches.

5.3 Gradient Descent Optimization

A natural approach to optimization of a continuously differentiable functionis to start at an initial value x(0), and then incrementally move in the oppo-site direction of the gradient. Intuitively, the gradient is the direction of thefunction’s most rapid increase, so one would expect moving in the opposite di-rection to be an effective method for minimizing the function. This approachto optimization is generally referred to as gradient descent optimization.

Page 100: Model Based Image Processing (Text)

90 MAP Estimation with Gaussian Priors

The general form of gradient descent iterations is given by

x(k+1) = x(k) − β∇f(x(k))

where x(k) is the current image estimate, x(k+1) is the updated image, and βis a positive step size that determines how far one moves along the negativegradiant direction. For the image restoration problem of (5.10), the gradientof f(x) is given by

∇f(x) = − 1

σ2At(y − Ax) +Bx . (5.12)

So for this case, the gradient descent update equation is given by

x(k+1) = x(k) + α[At(y − Ax(k))− σ2Bx(k)] (5.13)

where α = β/σ2 is a scaled version of the step size. Rearranging terms, wehave the recursion

x(k+1) = (I − α[AtA+ σ2B])x(k) + αAty . (5.14)

An important special case of (5.14) occurs when A represents a linearspace-invariant filter with 2-D impulse response as. When A represents aspace-invariant filter, then it has a Toeplitz-block-Toeplitz structure, and theoperation Ax is equivalent to the truncated 2-D convolution as∗xs. Similarly,multiplication by the transpose, Aty, is equivalent to 2-D convolution with thespace-reversed impulse response, a−s ∗ ys. In this case, the gradient descentupdate equation of (5.13) has the form

x(k+1)s = x(k)s + α[a−s ∗ (ys − as ∗ x(k)s )− λ(δs − gs) ∗ x(k)s ] , (5.15)

where gs is the non-causal predictor for the GMRF and λ = σ2/σ2x is a

measure of the noise-to-signal ratio. Here you can see that each iterationof gradient descent is computed through the application of LSI filters; so aslong as the filter impulse response is spatially limited, the computation is notexcessive.

5.3.1 Convergence Analysis of Gradient Descent

Gradient descent is a simple algorithm, but it has a key disadvantage relatedto the difficulty in selection of the step-size parameter. In order to better

Page 101: Model Based Image Processing (Text)

5.3 Gradient Descent Optimization 91

−1.5−1

−0.50

0.51

1.5

−1.5

−1

−0.5

0

0.5

1

1.5

0

0.2

0.4

0.6

0.8

1

x axis

yaxis

−1.5−1

−0.50

0.51

1.5 −1.5

−1

−0.5

0

0.5

1

1.5

0

0.2

0.4

0.6

0.8

1

yaxis

x axis

Figure 5.1: 3-D rendering of the example non-quadratic function from two differentviews. The analytical form of the function is 1

(x−y)2+1exp(−4(x+ y)2).

Gradiant Ascent: N = 100, Step Size = 0.020000

x axis

yaxi

s

−1.5 −1 −0.5 0 0.5 1 1.5−1.5

−1

−0.5

0

0.5

1

1.5Gradiant Ascent: N = 100, Step Size = 0.060000

x axis

yaxi

s

−1.5 −1 −0.5 0 0.5 1 1.5−1.5

−1

−0.5

0

0.5

1

1.5Gradiant Ascent: N = 100, Step Size = 0.180000

x axis

yaxi

s

−1.5 −1 −0.5 0 0.5 1 1.5−1.5

−1

−0.5

0

0.5

1

1.5

(a) (b) (c)

Figure 5.2: 2-D contour plots of the trajectory of gradient descent optimization usinga step size of a) α = 0.02; b) α = 0.06; c) α = 0.18. Notice that the convergence withsmall α is slow, and the convergence with large α is unstable.

illustrate this issue, consider the minimization of the 2-D function c(x, y) =− 1

(x−y)2+1 exp(−4(x+ y)2). Some intuition into the structure of this functioncan be gleaned from Figure 5.1, which shows a 3-D rendering of the negativeof the function, −c(x, y). First notice that the function has a sharp peak butbecomes relatively flat in regions further from its maximum. Also, it shouldbe noted that maximization of −c(x, y) (using for example gradient ascent)is equivalent to minimization of c(x, y) (using for example gradient descent).

Figure 5.2 shows the corresponding convergence behavior of gradient de-scent for three different step sizes. Too large of a step size results in theunstable convergence shown in Figure 5.2c, whereas too small of a step sizeresults in the slow convergence of Figure 5.2a. Unfortunately, for high dimen-sional optimization problems such as (5.10), we will see that there is oftenno good choice of α.

Page 102: Model Based Image Processing (Text)

92 MAP Estimation with Gaussian Priors

To better understand why this is true, we can analyze the convergencebehavior of the gradient descent algorithm. Let us assume that the iterationof (5.14) converges to the limit x(∞), then we can define the error in thecalculation of the MAP estimate to be ǫ(k) = x(k) − x(∞). In this case, weknow that taking the limit of (5.14) results in

x(∞) = (I − α[AtA+ σ2B])x(∞) + αAty . (5.16)

Subtracting (5.14) and (5.16) results in

ǫ(k+1) =(

I − α[AtA+ σ2B])

ǫ(k) . (5.17)

We can further simplify the structure of (5.17) by using eigenvector analysisof the matrix

H= AtA+ σ2B .

Since H is symmetric, we know it can be diagonalized as H = EΛEt wherecolumns of E are the orthonormal eigenvectors ofH, and Λ = diagh1, · · · , hNis a diagonal matrix containing the corresponding N eigenvalues of H. Noticethat the eigenvalues, hi, are all strictly positive because H is formed by thesum of two positive-definite matrices. If we define the transformed error asǫ(k) = Etǫ(k), then we may derive the following simple relationship for thedecay of the error in the gradient descent method.

ǫ(k) = (I − αΛ)k ǫ(0) . (5.18)

Since Λ is diagonal, we can see that the ith component of the error thendecays as

ǫ(k)i = (1− αhi)

k ǫ(0)i . (5.19)

Equation (5.19) provides great insight into the convergence of gradientdescent to the MAP estimate. First, in order for convergence to be stable,we must have that |1−αhi| < 1 for all i. Second, in order for convergence tobe rapid, we would like that 1 − αhi ≈ 0 for all i. As we will see, it is easyto make convergence fast for one i, but it is generally not possible to make itfast for all i.

A typical approach is to select α so that convergence is fast for the largesteigenvalue, hmax = maxihi. To do this we select α so that 1− αhmax = 0,which implies that

α =1

hmax.

Page 103: Model Based Image Processing (Text)

5.3 Gradient Descent Optimization 93

−4 −2 0 2 40

0.5

1

1.5

2

2.5

3

3.5

4Spectrum of Operator h(ω )

Frequency in Radians

Gai

n

−4 −2 0 2 40

0.2

0.4

0.6

0.8

1

Spectrum of Operator 1 − h(ω )/hmax

Frequency in Radians

Gai

n

0−4 −2 0 2 40

20

40

60

80

100Number of Iterations required for 99% Convergence

Frequency in Radians

Num

ber

of It

erat

ions

(a) (b) (c)

Figure 5.3: Plots showing (a) the frequency response of h(ω), (b) the resulting func-tion 1 − h(ω)/hmax which determines the convergence rate of gradient descent for astep-size with good low frequency convergence, (c) the number of iterations of gradientdescent required for 99% convergence. Notice that gradient descent has slow conver-gence at high frequencies. In fact, this tends to be a general property of gradientdescent for deblurring problems.

However, when we do this the mode associated with the smallest eigenvalue,hmin = minihi, has very slow convergence. To see this, let imin be the indexof the smallest eigenvalue, then the convergence of the associated mode isgiven by

ǫ(k)imin

ǫ(0)imin

= (1− αhmin)k =

(

1− hmin

hmax

)k

=

(

1− 1

κ(H)

)k

where κ(H) = hmax

hminis the condition number of the matrix H. So if κ is very

large, then 1 − 1κ(H) is very close to 1, and the convergence for the mode

corresponding to the smallest eigenvalue will be very slow.

In many applications, the condition number of H can be very large. Whenthis is the case, it is not possible to choose α to achieve fast and stable con-vergence for both large and small eigenvalues. In general, small eigenvalueswill converge slowly; and if one tries to speed the convergence of small eigen-values by increasing α, then the modes with large eigenvalues can becomeunstable.

5.3.2 Frequency Analysis of Gradient Descent

In many practical situations, the matrix A represents a linear space-invariantfilter applied over a large region. In this case, the convolutions of equa-

Page 104: Model Based Image Processing (Text)

94 MAP Estimation with Gaussian Priors

tion (5.15) can be approximated by multiplication in the frequency domain,and it is possible to gain more insight into the convergence behavior of gra-dient descent. More specifically, taking the DSFT of (5.15) and rearrangingterms results in the following relationship.

x(k+1)(ω) =(

1− α[

|a(ω)|2 + λ(1− g(ω))])

x(k)(ω) + αa∗(ω)y(ω) (5.20)

If we further define ǫ(k)(ω) to be the DSFT of ǫ(k)s = x

(k)s − x∞s , then we can

derived a recursion for the error in the computation of the MAP estimate.

ǫ(k+1)(ω) =(

1− α[

|a(ω)|2 + λ(1− g(ω))])

ǫ(k)(ω) (5.21)

Using the definition that

h(ω)= |a(ω)|2 + λ(1− g(ω)) , (5.22)

we have that

ǫ(k)(ω) = (1− αh(ω))k ǫ(0)(ω) .

So here we can see that the values of the frequency transform h(ω) are es-sentially the eigenvalues of H. Furthermore, we know that h(ω) > 0 due tothe fact that 1− g(ω) > 0.

If we again define hmax = maxω h(ω) and hmin = minω h(ω), then we canselect α for fast convergence for the largest eigenvalue which results in

ǫ(k)(ω) =

(

1− h(ω)

hmax

)k

ǫ(0)(ω) .

Example 5.1. Consider a 1-D signal deconvolution problem of the form

Yn =1∑

k=−1akXn−k +Wn ,

where

an = δn +1

2(δn−1 + δn+1)

is a smoothing filter, and Wn is additive noise modeled as i.i.d. Gaussianrandom variables with N(0, σ2) distribution. We will use a prior model for

Page 105: Model Based Image Processing (Text)

5.3 Gradient Descent Optimization 95

X of a GMRF with a non-causal prediction variance of σ2x and a non-causal

prediction filter of the form

gn =1

2(δn−1 + δn+1) .

Taking the DTFT of an and gn results in the following expressions.

a(ω) = 1 + cos(ω)

1− g(ω) = 1− cos(ω)

If we assume that σ2 = 1 and σ2x = 10, then λ = σ2/σ2

x = 1/10, and we cancalculate the following explicit expression for h(ω) by using equation (5.22).

h(ω)= |1 + cos(ω)|2 + 1

10(1− cos(ω))

Figure 5.3(a) shows a plot of h(ω). Notice that the function has a low passnature because it is computed from the blurring kernel an. The maximumof h(ω) occurs at ω = 0 and the minimum at ω = ±π, and these valuescorrespond to hmax = 4 and hmin = 1/5. If we set the step size to α =1/hmax = 1/4, then the convergence at frequency ω is given by

ǫ(k)(ω) =

(

1− h(ω)

4

)k

ǫ(0)(ω) .

Figure 5.3(b) shows a plot of the function 1 − h(ω)4 . Notice that it takes

on its largest values at ω = ±π. This means the convergence will be slowestat the high frequencies. Figure 5.3(c) makes this clearer by plotting thenumber of iterations required for 99% convergence of the gradient descentalgorithm as a function of frequency. Notice that at ω = 0, convergence isin 1 iteration; but at a frequency of ω = π, gradient descent takes over 90iterations to converge.

This result of Example 5.1 is typical for the application of gradient descentto deconvolution or deblurring problems. Low spatial frequencies tend toconverge rapidly, but high spatial frequencies tend to converge slowly. Whensolving 2-D problems, this means that the low frequency shading tends toconverge quickly, but the high frequency detail, such as edges, converge slowly.This is a serious problem in imaging problems because typically edge contentis particularly important in the perceived quality of an image.

Page 106: Model Based Image Processing (Text)

96 MAP Estimation with Gaussian Priors

Steepest Ascent: N = 10

x axis

yaxi

s

−1.5 −1 −0.5 0 0.5 1 1.5−1.5

−1

−0.5

0

0.5

1

1.5Coordinate Ascent: N = 10

x axis

yaxi

s

−1.5 −1 −0.5 0 0.5 1 1.5−1.5

−1

−0.5

0

0.5

1

1.5

(a) (b)

Figure 5.4: 2-D contour plots of the trajectory of a) gradient descent with line searchand b) iterative coordinate descent. Neither of these algorithms require the choice ofa step parameter α.

5.3.3 Gradient Descent with Line Search

One partial solution to the problem of selecting a step size is to choose thevalue of α at each iteration that minimizes the cost function. In order todo this, we will need to introduce a very important concept known as linesearch for finding the minimum of any 1-D cost function. The three updateequations for gradient descent with line search are listed below.

d(k) = −∇f(x(k)) (5.23)

α(k) = argminα≥0

f(x(k) + αd(k)) (5.24)

x(k+1) = x(k) + α(k)d(k) (5.25)

The first step of equation (5.23) determines the update direction, d(k). Thesecond step of equation (5.24) then determines the value of the step size thatminimizes the cost function along the direction of the search. This step isknown as line search since it searches along a line in the direction of d(k). Itis often the case that the line search can actually dominate the computationin an optimization strategy; so the design of effective line search strategieswill be an important theme to come. The third step of equation (5.25) thenupdates the state to form x(k+1).

One approach to solving the line search problem is to root the derivativeof the 1-D function. This can be done by finding a value of α which solvesthe following equation.

0 =∂f(x(k) + αd(k))

∂α=[

∇f(x(k) + αd(k))]t

d(k) (5.26)

Page 107: Model Based Image Processing (Text)

5.4 Iterative Coordinate Descent Optimization 97

In some cases, the line search required for steepest descent can be com-putationally intensive, but for quadratic optimization it can be computedin closed form with modest computation. Applying the gradient expressionof (5.26) to the cost function of (5.11) results in the following closed formexpression for the step size,

α(k) =(y − Ax(k))tAd(k) − σ2

[

x(k)]tBd(k)

||d(k)||2H, (5.27)

where H = AtA+σ2B, and we use the notation ||z||2W = ztWz for a positive-definite matrix W . Notice that the expression of equation (5.27) holds forany choice of direction d(k) as long as the cost function of (5.11) is used.This is important because in later sections we will introduce methods suchas conjugate gradient that introduce modifications to the gradient.

However, for the image restoration problem of (5.10), the gradient direc-tion is given by

d(k) =1

σ2At(y − Ax(k))− Bx(k) , (5.28)

and in this case, the step size has an even simpler form given by

α(k) = σ2 ||d(k)||2||d(k)||2H

. (5.29)

Figure 5.4(a) illustrates the results of gradient descent with line searchfor the cost function of Figure 5.1. Notice that the convergence of steepestdescent cost function is guaranteed to be stable because with each iterationthe cost function is monotone decreasing.

f(x(k+1)) ≤ f(x(k))

If the cost function f(x) is bounded below, as is the case for our problem,then we know that limk→∞ f(x(k)) converges.

5.4 Iterative Coordinate Descent Optimization

As we saw in Section 5.3.2, gradient descent tends to have slow convergenceat high spatial frequencies. In practice, most gradient based methods tend to

Page 108: Model Based Image Processing (Text)

98 MAP Estimation with Gaussian Priors

converge faster at low spatial frequencies for problems that require deblurringor deconvolution of an image. An alternative optimization approach withfaster convergence at high spatial frequencies is the iterative coordinatedescent (ICD) algorithm.1 ICD works by updating each pixel in sequencewhile keeping the remaining pixels fixed. One full iteration of ICD thenconsists of a sequence of single updates, were each pixel in x is updatedexactly once.

The ICD algorithm is most easily specified using the assignment notationof a programming language. Using this notation, the value of the pixel xs isupdated using the rule

xs ← arg minxs∈R

f(x)

while the remaining pixels xr for r 6= s remain unchanged. The result of anICD update of the pixel s can be compactly expressed as x + αεs where εsis a vector that is 1 for element s, and 0 otherwise. Using this notation, wehave that

xs ← xs + argminα∈R

f(x+ αεs) .

The ICD update can then be computed by solving the equation

0 =∂f(x+ αεs)

∂α= [∇f(x+ αεs)]

t εs ,

which results in

α =(y − Ax)tA∗,s − σ2xtB∗,s||A∗,s||2 + σ2Bs,s

, (5.30)

where A∗,s and B∗,s denote the sth column of A and B respectively. This thenresults in the ICD update equation

xs ← xs +(y − Ax)tA∗,s − λ

(

xs −∑

r∈∂s gs−rxr)

||A∗,s||2 + λ, (5.31)

where λ = σ2

σ2xis the effective noise-to-signal ratio.

Direct implementation of the ICD algorithm using (5.31) requires the eval-uation of the term y − Ax with each pixel update. Typically, this requires

1 The Gauss-Seidel algorithm for solving differential equations works by updating each point in sequenceto meet the constraint of the differential equation. The Gauss-Seidel method is in many ways analogous toICD, and the techniques for analyzing the two algorithms are closely related.

Page 109: Model Based Image Processing (Text)

5.4 Iterative Coordinate Descent Optimization 99

ICD Algorithm:

Initialize e← y − AxFor K iterations

For each pixel s ∈ S v ← xs

xs ← xs +etA∗,s − λ

(

xs −∑

r∈∂s gs−rxr

)

||A∗,s||2 + λ

e ← e− A∗,s(xs − v)

Figure 5.5: Pseudocode for fast implementation of the ICD algorithm. The speedupdepends on the use of a state variable to store the error, e = y − Ax.

too much computation. Fortunately, there is a simple method for speed-ing the computation by keeping a state variable which stores the error terme = y − Ax. The pseudocode for this faster version of ICD is shown inFigure 5.5.

As with gradient descent, an important special case of (5.31) occurs whenA represents a linear space-invariant filter as. In this case, multiplication byA is equivalent to convolution with as; multiplication by At is equivalent toconvolution with a−s; and the ICD update has the form

xs ← xs +a−s ∗ (ys − as ∗ xs)− λ(xs −

r∈∂s gs−rxr)∑

s a2s + λ

. (5.32)

When the point spread function is as = δs, then there is no blurring, and theupdate equation has a simpler form which lends insight into the process.

xs ←ys + λ

r∈∂s gs−rxr1 + λ

Notice that in this case, the ICD update is a weighted average between themeasurement, ys, and the non-causal prediction,

r∈∂s gs−rxr. When λ islarge and the signal-to-noise is low, then the update is weighted toward theneighboring pixel values; however, when λ is small and the signal-to-noise ishigh, then the update is weighted toward the measured data.

Page 110: Model Based Image Processing (Text)

100 MAP Estimation with Gaussian Priors

−4 −2 0 2 40

0.5

1

1.5

2

2.5

3

3.5

4Spectrum of Operator h(ω )

Frequency in Radians

Gai

n

−3 −2 −1 0 1 2 30

0.2

0.4

0.6

0.8

1

Spectrum of Operator P(ω) = U(ω )/( L(ω ) + h0 )

Frequency in Radians

Gai

n

−3 −2 −1 0 1 2 30

20

40

60

80

100Number of ICD Iterations required for 99% Convergence

Frequency in Radians

Num

ber

of It

erat

ions

(a) (b) (c)

Figure 5.6: Plots showing (a) the frequency response of h(ω), (b) the resulting func-

tion P (ω) =∣

−L∗(ω)L(ω)+h0

∣ which determines the convergence rate of ICD, (c) the number

of iterations of ICD required for 99% convergence. Notice that ICD has more uni-formly fast convergence across different frequencies as compared to gradient descent.

5.4.1 Convergence Analysis of Iterative Coordinate Descent

It is also possible to analyze the convergence of ICD, but the analysis is a bitmore tricky [58]. We first define the matrix

H= AtA+ σ2B .

Using the gradient expression of (5.12), the scaled gradient of f(x) can thenbe expressed as

σ2∇f(x) = −Aty +Hx .

The objective of coordinate descent is to minimize the cost as a function ofthe variable xs. So we enforce this condition by setting the sth gradient termto 0.

[∇f(x)]s =[

−Aty +Hx]

s= 0

This can be more explicitly written as

−∑

r∈Sar,syr +

r∈SHs,rxr = 0 . (5.33)

Now, let us assume that the ICD updates are performed in order. Whenwe update the pixel xs, the values of the previous pixels xr for r < s will havealready been updated, and the values of xr for r > s have yet to be updated.This means that at the kth iteration, the past pixels (i.e., r < s) take on their

new value, xr = x(k+1)r , and the future pixels (i.e., r > s) still retain their old

Page 111: Model Based Image Processing (Text)

5.4 Iterative Coordinate Descent Optimization 101

value, xr = x(k)r . Substituting these values into (5.33) results in the following

ICD update equation,

−∑

r∈Sar,syr +

[

r<s

Hs,rx(k+1)r

]

+Hs,sx(k+1)s +

[

r>s

Hs,rx(k)r

]

= 0 , (5.34)

where notice that xs = x(k+1)s because the result of solving this equation will

be to determine the updated value of xs.

Now since equation (5.34) holds for all values of r and s, it can be expressedmore simply in matrix notation. Specifically, we can partitionH into its lowertriangular, upper triangular, and diagonal portions. So let Lr,s = 0 for r ≤ sbe the lower triangular portion of H, and let Dr,s = 0 for r 6= s be its diagonalportion. Since H is symmetric, we know that its upper triangular portionmust be given by Lt. Then we have that

H = L+D + Lt .

Using this notation, equation (5.34) becomes

−Aty + (L+D)x(k+1) + Ltx(k) = 0 .

So the update equation for x(k) becomes

x(k+1) = −(L+D)−1(Ltx(k) − Aty) .

If we define ǫ(k) = x(k) − x(∞), then this equation becomes

ǫ(k+1) = −(L+D)−1Ltǫ(k) . (5.35)

The convergence of this equation can be studied in much the same way thatwe analyzed the convergence of equation (5.17) for gradient descent.

In order to illustrate this, we will consider the case when A and B areToeplitz matrices. In this case, the convergence of ICD can be analyzed inthe frequency domain. Since A is Toeplitz, multiplication by A is equivalentto convolution with as. We will also assume that B is equivalent to convolu-tion with 1

σ2x(δs − gs). So we have that multiplication by H is equivalent to

convolution by hs where

hs = as ∗ a−s + λ(δs − gs) , (5.36)

Page 112: Model Based Image Processing (Text)

102 MAP Estimation with Gaussian Priors

where λ = σ2/σ2x. Next we can define the functions corresponding the causal,

and memoryless parts of hs.

ls =

hs if s < 00 if s ≥ 0

, ds = h0δs

Then hs = ls + l−s + ds. The corresponding DSFTs of these functions thenbecome L(ω) andD(ω) = h0, respectively. Using these Fourier transforms, wecan then represent the update equation for the error in the ICD convergenceas

ǫ(k+1)(ω) =

( −L∗(ω)L(ω) + h0

)k

ǫ(0)(ω) .

So from this, we can see that the rate of convergence of the ICD algorithmis determined by the magnitude of the term

P (ω) =

L∗(ω)

L(ω) + h0

. (5.37)

If P (ω) is near zero, then convergence is rapid, but if it is near 1, thenconvergence is slow.

Example 5.2. Again consider the problem of 1-D deconvolution where ourobjective is to recover a sequence Xn from observations Yn defined by

Yn =1∑

k=−1akXn−k +Wn ,

where

an = δn +1

2(δn−1 + δn+1) ,

Wn is i.i.d. noise distributed as N(0, σ2), and X is a GMRF with a non-causalprediction variance of σ2

x and a non-causal prediction filter of the form

gn =1

2(δn−1 + δn+1) .

If we assume that σ2 = 1 and σ2x = 10, then we can compute the function hs

of equation (5.36) as

hn = an ∗ a−n +σ2

σ2x

(δn − gn)

Page 113: Model Based Image Processing (Text)

5.5 Conjugate Gradient Optimization 103

=3

2δn + (δn−1 + δn+1) +

1

4(δn−2 + δn+2) +

1

10δn −

1

20(δn−1 + δn+1)

=8

5δn +

19

20(δn−1 + δn+1) +

1

4(δn−2 + δn+2) .

So from this, we have that

ls =19

20δn−1 +

1

4δn−2 , ds =

8

5δn .

From this, we can calculate the function P (ω) from equation (5.37).

Figure 5.6(b) shows a plot of the function P (ω). Notice that its valueis substantially less than 1 for all ω. This means the convergence will berelatively fast for a wide range of frequencies. Figure 5.6(c) makes this clearerby plotting the number of iterations required for 99% convergence of the ICDalgorithm as a function of frequency. Comparing this to Figure 5.3(c), we cansee that ICD’s high frequency convergence is much more rapid than gradientdescent, with gradient descent requiring over 80 iterations and ICD requiringless than 20.

This result of Example 5.2 is typical of ICD which tends to have relativelyrapid convergence at high spatial frequencies for this type of problem. Whensolving 2-D problems, this means that the high frequency detail, such asedges, converge quickly. However, in some cases this can come at the costof slower convergence at low spatial frequencies. This is why it can often behelpful to use an initialization for ICD that accurately approximates the lowfrequency components to the MAP estimate.

5.5 Conjugate Gradient Optimization

One of the most popular and effective methods for doing optimization isknown as conjugate gradient (CG). As we saw in Section 5.3.1, the con-vergence speed of gradient descent algorithms tends to be limited by thecondition number of the matrix H. The CG method attempts to mitigatethis problem by enforcing the constraint that each new update is conjugateto the previous updates.

The theory of CG goes beyond this treatment, but the general form ofthe update equations are quite simple. The algorithm is initialized by setting

Page 114: Model Based Image Processing (Text)

104 MAP Estimation with Gaussian Priors

h(0) = d(0) = −∇f(x(0)) where x(0) is the initial value of the image x. Thenthe following iteration is run until the desired level of convergence is achieved.

d(k) = −∇f(x(k))

γk =(d(k) − d(k−1))td(k)

(d(k−1))td(k−1)

h(k) = d(k) + γkh(k−1)

α(k) = argminα≥0

f(x(k) + αh(k))

x(k+1) = x(k) + α(k)h(k)

It can be shown that when f(x) is a quadratic function of x, then the updatedirections, h(k), are conjugate, which is to say that the following relationshipholds,

(h(i))tHh(j) = 0 for i 6= j ,

and the algorithm converges to the global optimum in no more than N steps!Of course, in many cases, it would not be practical to run N iterations, butit is both interesting and reassuring to know that convergence is achieved ina finite number of iterations.

Page 115: Model Based Image Processing (Text)

5.6 Chapter Problems 105

5.6 Chapter Problems

1. Derive the expressions for µ(y) and R used in equation (5.7).

2. Consider a MAP estimation problem where the observations are given byY = AX +W where A ∈ R

M×N and X and W are independent jointlyGaussian random vectors with distributions given by X ∼ N(0, B−1),W ∼ N(0,Λ−1), where both B ∈ R

M×M and Λ ∈ RM×M are symmetric

and positive-definite matrix.

a) Write an expression for the conditional density, py|x(y|x).b) Write an expression for the prior density, px(x).

c) Write an expression for the MAP cost function, f(x), for this problem.

3. Consider the function

f(x) =1

2||y − Ax||2Λ +

1

2xtBx ,

where y ∈ RM , x ∈ R

N , and B ∈ RN×N is a symmetric positive semi-

definite matrix.

a) Calculate ∇f(x), the gradient of the cost function.

b) Calculate H(x), the Hessian matrix of the cost function given by

[H(x)]s,r =∂2f(x)

∂xs∂xr

c) Calculate the global minimum of the cost function.

4. Show that the update step for gradient descent with line search is givenby equations (5.27) and (5.29).

5. Show that the ICD update step is given by equation (5.30).

6. Let X ∈ RN be an N pixel image that we would like to measure, and

let Y ∈ RN be the noisy measurements given by

Y = AX +W

where A is an N × N nonsingular matrix, W is a vector of i.i.d. Gaus-sian noise with W ∼ N(0,Λ−1). Furthermore, in a Bayesian framework,

Page 116: Model Based Image Processing (Text)

106 MAP Estimation with Gaussian Priors

assume that X is a GMRF with noncausal prediction filter gs and non-causal prediction variance σ2.

a) Derive an expression for the ML estimate of X.

b) Derive an expression for the MAP estimate ofX under the assumptionthat X is a zero mean GMRF with inverse covariance matrix B.

c) Derive an expression for the MAP cost function f(x).

7. Consider the optimization problem

x = arg minx∈RN

||y − Ax||2Λ + xtBx

where A is a nonsingular N ×N matrix, B is a positive-definite N ×N

matrix, and Λ is a diagonal and positive-definite matrix..

a) Derive a closed form expression for the solution.

b) Calculate an expression for the gradient descent update using stepsize µ ≥ 0.

c) Calculate an expression for the update of gradient descent with linesearch.

d) Calculate an expression for the conjugate gradient update.

e) Calculate an expression for the coordinate descent update.

8. Consider the optimization problem

x = arg minx∈RN

||y − Ax||2Λ + xtBx

where A is a nonsingular N × N matrix, B is a symmetric positive-definite N × N matrix, and Λ is a diagonal positive-definite matrix.Furthermore, let x(k) denote the approximate solution of the optimiza-tion after k iterations of an optimization technique, and let ǫ(k) = x(k)−xbe the convergence error after k iterations.a) Calculate the update recursion for ǫ(k) with gradient descent opti-mizationb) Under what conditions does gradient descent have stable convergence?c) Calculate the update recursion for ǫ(k) with ICD optimization. (As-sume a single iteration consists of a single update of each pixel in rasterorder)

Page 117: Model Based Image Processing (Text)

5.6 Chapter Problems 107

d) Under what conditions does coordinate descent have stable conver-gence?

Page 118: Model Based Image Processing (Text)

108 MAP Estimation with Gaussian Priors

Page 119: Model Based Image Processing (Text)

Chapter 6

Non-Gaussian MRF Models

In Chapters 4 and 5, we introduced the GMRF and showed how it can be usedas an image model in applications such as image restoration or reconstruction.However, one major limitation of the GMRF is that it does not accuratelymodel the edges and other discontinuities that often occur in real images.In order to overcome this limitation, we must extend our approach to non-Gaussian models.

The purpose of this chapter is to generalize the GMRF of the previouschapters to non-Gaussian random fields. To do this, we will introduce theconcept of a pair-wise Gibbs distribution, and show that, while it includes theGMRF, it can be used to naturally generalize the GMRF to non-Gaussianrandom fields. We will also present a set of commonly used non-GaussianMRF models, and develop some tools for selecting their parameters.

6.1 Continuous MRFs Based on Pair-Wise Cliques

In this section, we develop image models which explicitly represent the prob-ability distribution for an image in terms of the differences between neighbor-ing pixels. In order to do this, we must first reformulate the GMRF modelso that it is expressed in terms of pixel differences. Once this is done, we canthen generalize the GMRF model to non-Gaussian distributions.

First, let us review the concept of a neighborhood system, ∂s, and itsassociated pair-wise cliques, P , from Section 4.6. Recall that ∂s ⊂ S is theset of neighboring pixels to s and that r ∈ ∂s if and only if s ∈ ∂r. So if s is aneighbor of r, then r must be a neighbor of s. Then for a given neighborhood

Page 120: Model Based Image Processing (Text)

110 Non-Gaussian MRF Models

system, we defined the set of pair-wise cliques as P = s, r : s ∈ ∂r. SoP is then the set of all unordered neighboring pixel pairs s, r such thatr ∈ ∂s.

Using these conventions, the distribution of a zero-mean GMRF can bewritten as

p(x) =1

zexp

−12xtBx

, (6.1)

where Br,s = 0 when r 6∈ ∂s ∪ s, and z is the normalizing constant for thedistribution known as the partition function. We also note that X is then aGaussian random vector with density N(0, B−1).

We would like to rewrite this expression in a way that makes the depen-dence on differences between neighboring pixels more explicit. To do this, weintroduce a very useful vector-matrix relationship as the following property.

Property 6.1. Pairwise quadratic form identity - Let B ∈ RN×N be any sym-

metric matrix and let x ∈ RN be any vector. Then the following identity

holds

xtBx =∑

s∈Sasx

2s +

1

2

s∈S

r∈Sbs,r|xs − xr|2 , (6.2)

where as =∑

r∈S Bs,r and bs,r = −Bs,r.

Moreover, for the particular case of a GMRF with neighborhood system∂s, we know that the terms Bs,r = 0 for r 6∈ ∂s∪s, so we have the followinggeneral relationship.

xtBx =∑

s∈Sasx

2s +

s,r∈Pbs,r|xs − xr|2 (6.3)

Notice that in the case of (6.3) the factor of 1/2 is removed because the sumis over all unique unordered pairs of s, r.

When used to model images, the coefficients as are most often chosen tobe zero. By choosing as = 0, we ensure that the prior probability of an imagex is invariant to additive constant shifts in the pixel values. To see this,consider the image x and a shifted image, xs = xs+1 for all s ∈ S. If as = 0,then only terms of the form xs − xr remain in the expression of (6.2). Sinceany additive constant cancels in these terms, we know that

xtBx = xtBx ,

Page 121: Model Based Image Processing (Text)

6.1 Continuous MRFs Based on Pair-Wise Cliques 111

so the two images are equally probable.1

By dropping these terms, and using the relationship of (6.3), we get thefollowing pair-wise GMRF distribution.2

p(x) =1

zexp

−∑

s,r∈Pbs,r|xs − xr|2

2

(6.4)

Notice that the distribution of (6.4) is explicitly written in terms of the dif-ferences between neighboring pixels. So if bs,r > 0, then as the squared pixeldifference |xs − xr|2 increases, the probability decreases. This is reasonablesince we would expect nearby pixels to have similar values.

However, a limitation of the GMRF model is that it can excessively penal-ize the differences between neighboring pixels. This is because, in practice,the value of |xs − xr|2 can become very large when xs and xr fall across adiscontinuous boundary in an image. A simple solution to this problem isto replace the function |xs−xr|2

2 with a new function ρ(xs − xr), which growsless rapidly. With this strategy in mind, we define the pair-wise Gibbsdistribution as any distribution with the form

p(x) =1

zexp

−∑

s,r∈Pbs,rρ(xs − xr)

. (6.5)

Later in Chapter 13, we will give a more general definition for the Gibbsdistributions, but it is interesting to note that the concept is borrowed fromstatistical thermodynamics (See Appendix B). In thermodynamics, the Gibbsdistribution is a distribution of the form p(x) = 1

z exp −u(x) where u(x) isthe energy of the system.3 So for our problem, the energy function of thepair-wise Gibbs distribution is given by

u(x) =∑

s,r∈Pbs,rρ(xs − xr) , (6.6)

1 However, it should be noted that in this case the determinant of the inverse covariance matrix B becomeszero, which is technically not allowed. However, this technical problem can always be resolved by computingthe MAP estimate with as > 0 and then allowing as to go to zero.

2 Again, we note that the value of the partition function, z, in this expression becomes infinite because ofthe singular eigenvalue in B. However, this technical problem can be resolved by taking the limit as as → 0.

3 In thermodynamics, the more general expression for the Gibbs distribution (also known as the Boltzmann

distribution) is p(x) = 1zexp

− 1kbT u(x)

where kb is Boltzmann’s constant, T is the absolute temperature,

and u(x) is the energy of the system in state x. So we will assume that kbT = 1.

Page 122: Model Based Image Processing (Text)

112 Non-Gaussian MRF Models

where the function ρ(∆) for ∆ = xs − xr is known as the potential func-

tion, and its derivative, ρ′(∆) = dρ(∆)d∆ , is known as the associated influence

function.

The choice of the potential function, ρ(∆), is very important since it de-termines the accuracy of the MRF model, and ultimately in applications, itcan determine the accuracy of the MAP estimate. While the selection of thepotential function will be a major theme of this section, we can immediatelyintroduce three properties that we will expect of ρ(∆).

Zero at origin: ρ(0) = 0

Symmetric: ρ(−∆) = ρ(∆)

Monotone increasing: ρ(|∆|+ ǫ) ≥ ρ(|∆|) for all ǫ > 0

Importantly, the pair-wise Gibbs distribution of equation (6.5) is still thedistribution of an MRF. That is, each pixel, xs, is conditionally independentof the remaining pixels given its neighbors. To see this, we can factor the pair-wise Gibbs distribution into two portions: the portion that has a dependencyon xs, and the portion that does not. This results in the relation,

p(x) =1

zexp

−∑

s,r∈Pbs,rρ(xs − xr)

=1

zexp

−∑

r∈∂sbs,rρ(xs − xr)

f(xr 6=s) ,

where f(xr 6=s) is a function of the pixels xr for r 6= s. Using the factored form,we may calculate the conditional distribution ofXs given the remaining pixelsXr for r 6= s as

pxs|xr 6=s(xs|xr 6=s) =

p(x)∫

Rp(xs, xr 6=s)dxs

=p(xs, xr 6=s)

Rp(xs, xr 6=s)dxs

=1z exp

−∑r∈∂s bs,rρ(xs − xr)

f(xr 6=s)∫

R

1z exp

−∑

r∈∂s bs,rρ(xs − xr)

f(xr 6=s)dxs

=exp

−∑r∈∂s bs,rρ(xs − xr)

Rexp

−∑r∈∂s bs,rρ(xs − xr)

dxs.

Page 123: Model Based Image Processing (Text)

6.1 Continuous MRFs Based on Pair-Wise Cliques 113

However, since this result is only a function of xs and its neighbors, we havethat

pxs|xr 6=s(xs|xr 6=s) = pxs|x∂s

(xs|x∂s) .

This type of local dependency in the pixels of X is very valuable. In fact, itis valuable enough that it is worth giving it a name.

Definition 9. Markov Random Field (MRF)A random field, Xs for s ∈ S with neighborhood system ∂s is said tobe a Markov random field (MRF) if for all s ∈ S, the conditionaldistribution of Xs is only dependent on its neighbors, i.e.,

pxs|xr 6=s(xs|xr 6=s) = pxs|x∂s

(xs|x∂s) ,

where x∂s denotes the set of xr such that r ∈ ∂s.

Using this definition, we may state the following very important propertyof pair-wise Gibbs distributions.

Property 6.2. Pair-wise Gibbs distributions are the distributions of an MRF- Let Xs have a pair-wise Gibbs distribution, p(x), with pair-wise cliques P ,then Xs is an MRF with neighborhood system ∂s = r ∈ S : r, s ∈ P,and the conditional probability of a pixel given its neighbors is given by

pxs|x∂s(xs|x∂s) =

1

zexp

−∑

r∈∂sbs,rρ(xs − xr)

, (6.7)

where z =

R

exp

−∑

r∈∂sbs,rρ(xs − xr)

dxs.

It is important to note, that while pair-wise Gibbs distributions parame-terize a family of MRFs, there exist MRFs that do not have pair-wise Gibbsdistributions. So the family of all distributions for MRFs is much larger. Infact, in Section 13.1, we will discuss this issue in detail, and show that thefamily of all MRFs is parameterized by a specific family of Gibbs distributionsconstructed from more general groups of pixels known as cliques.

Page 124: Model Based Image Processing (Text)

114 Non-Gaussian MRF Models

6.2 Selection of Potential and Influence Functions

The question remains of how to select a potential function that best modelsreal images? One place to start is to look at the conditional distribution of apixel, xs, given its neighbors, x∂s. In particular, the most probable value ofxs given its neighbors is the solution to the optimization problem,

xs = argmaxxs∈R

log pxs|x∂s(xs|x∂s)

= arg minxs∈R

r∈∂sbs,rρ(xs − xr) , (6.8)

which can be in turn computed as the solution to the equation∑

r∈∂sbs,rρ

′(xs − xr) = 0 . (6.9)

Equation (6.8) has an interpretation of energy minimization where the termsρ(xs − xr) represent the potential energy associated with the two pixels xsand xr. Alternatively, equation (6.9) has the interpretation of a force balanceequation where the terms ρ′(xs − xr) represent the force that the pixel xrexerts on the estimate xs.

This interpretation of ρ(xs − xr) as energy and ρ′(xs − xr) as force servesas a useful tool for the design and selection of these potential functions.The function ρ′(∆) is usually referred to as the influence function becauseit determines how much influence a pixel xr has on the MAP estimate of apixel xs.

Figure 6.1 shows the potential and influence functions for two possiblechoices of the potential function which we will refer to as the Gaussianpotential and Weak-spring potential [11, 10] functions.

Gaussian potential: ρ(∆) = |∆|2Weak-spring potential: ρ(∆) = min

|∆|2, T 2

Notice that the weak-spring potential requires the choice of an additionalparameter T that we set to 1 for the plots. Along with each potential function,we also show the associated influence function since this gives an indication ofthe “force” resulting from neighboring pixels. Notice that with the Gaussianprior, the influence of a pixel is linearly proportional to the value of ∆ =

Page 125: Model Based Image Processing (Text)

6.2 Selection of Potential and Influence Functions 115

−2 0 20

1

2

3

Gaussian (L2) Potential

Gaussian (L2) potential function

−2 0 2−3

−2

−1

0

1

2

3

Gaussian (L2) Influence

Gaussian (L2) influence function

−2 0 20

1

2

3Blake and Zisserman Potential

Weak spring potential function

−2 0 2−3

−2

−1

0

1

2

3Blake and Zisserman Influence

Weak spring influence function

Figure 6.1: List of the potential and influence functions for the Gaussian prior andweak-spring model. With the Gaussian prior, the influence of a pixel is unbounded,and it increases linearly with the value of ∆. However, with the weak spring model,the influence drops to zero when the value of |∆| exceeds a threshold T .

xs − xr. Therefore, the influence of xr on the estimate of xs is unbounded,and a neighboring pixel on the other side of an edge can have an unboundedeffect on the final estimate of xs.

Alternatively, with the weak spring potential, the influence of a neighbor-ing pixel is bounded because the potential function is clipped to the valueT 2. This bounded influence of neighboring pixels is clearly shown by theassociated influence function, which goes to zero for |∆| > T . This meansthat pixel differences greater than T have no influence on the final estimateof xs. If the pixels lie across a boundary or edge in an image, this lack ofinfluence can be very desirable, since it minimizes any blurring and thereforepreserves the edge detail.

Figure 6.2 shows some additional potential functions with a similar na-

Page 126: Model Based Image Processing (Text)

116 Non-Gaussian MRF Models

ture to the weak-spring potential. Each of these potential functions has theproperty that ρ(∆) is a non-convex function of ∆. (Appendix A contains areview of convexity including precise definitions and important properties.)In fact, all non-convex potential functions have the property that their influ-ence functions (i.e., derivatives) must sometimes decrease as ∆ increases.

Non-convex potential functions do a good job of precisely defining edges.Intuitively, non-convex functions typically have a region |∆| < Tc such thatρ′(∆) is strictly increasing (i.e., ρ(∆) is locally convex), and a region |∆| > Tc

such that ρ′(∆) is decreasing (i.e., ρ(∆) is locally concave). These two regionsclearly delineate between the “edge” and “non-edge” cases. However, in thenext section, we will also see that non-convex cost functions have limitations.

ρ(∆) Reference Potential Function Influence Function

min |∆|2, TBlake & Zisserman [11,10]“Weak spring”

−2 0 20

1

2

3Blake and Zisserman Potential

−2 0 2−3

−2

−1

0

1

2

3Blake and Zisserman Influence

∆2

T 2+∆2 Geman & McClure [30, 31]

−2 0 20

1

2

3Geman and McClure Potential

−2 0 2−3

−2

−1

0

1

2

3Geman and McClure Influence

log (T 2 +∆2) Hebert & Leahy [36]

−2 0 20

1

2

3Hebert and Leahy Potential

−2 0 2−3

−2

−1

0

1

2

3Hebert and Leahy Influence

|∆|T+|∆|

Geman & Reynolds [26]

−2 0 20

1

2

3Geman and Reynolds Potential

−2 0 2−3

−2

−1

0

1

2

3Geman and Reynolds Influence

Figure 6.2: List of the potential and influence functions for a variety of non-convexpotential functions plotted for T = 1.

Page 127: Model Based Image Processing (Text)

6.3 Convex Potential Functions 117

6.3 Convex Potential Functions

While non-convex potential functions can preserve edges better than a GMRFmodel, they also tend to generate discontinuous estimates at image bound-aries which are typically perceived as undesirable visual artifacts. For someapplications, such as edge detection, this type of abrupt change at edges canbe desirable. However, in applications where the output needs to be viewedas a physical image (i.e., photography, medical imaging, etc.), then this typeof very abrupt change can be undesirable.

Figures 6.3 illustrates how this discontinuous behavior can effect the resultof MAP estimation. Figure 6.3(a) shows two slightly different signals thatare used as input to a MAP cost function which uses the non-convex weak-spring prior model. (See [13] for details of the experiment and model.) Noticethat only a slight change in the input, y, results in a discontinuous jump inthe MAP estimate shown in Figure 6.3(b). While this type of discontinuousbehavior can be desirable in applications such as edge detection, it is typicallynot good when the result, x, is to be viewed as an image, or when it isimportant to preserve subtle details of continuous variation in the originaldata.

-2

-1

0

1

2

3

4

5

6

0 5 10 15 20 25 30 35 40 45 50

Noisy Signals

signal #1

signal #2

Unstable Reconstructions

signal #1

signal #2

-2

-1

0

1

2

3

4

5

6

0 5 10 15 20 25 30 35 40 45 50

(a) (b)

Figure 6.3: Illustration of how the MAP estimate can actually be unstable in prac-tice. Figure a) shows two slightly different signals that are used as input to a MAPcost function incorporating non-convex potential functions. Notice that only a slightchange in the input, y, results in a discontinuous jump in the MAP estimate shownin Figure b).

In Section 7.1, we will see that convex potential functions have two majoradvantages when the data term is also convex. First, they result in contin-uous or stable MAP estimates, so the resulting images tend to have fewer

Page 128: Model Based Image Processing (Text)

118 Non-Gaussian MRF Models

undesirable artifacts. And second, the resulting optimization problem forMAP estimation is also convex, so it is typically possible to compute theglobal maximum of the posterior density in tractable time.

ρ(∆) Reference Potential Function Influence Function

∆2

2

Gaussian MRF“Quadratic”

−2 0 20

1

2

3

Gaussian (L2) Potential

−2 0 2−3

−2

−1

0

1

2

3

Gaussian (L2) Influence

|∆| Besag[9]“Total Variation”

−2 0 20

1

2

3

Total Variation (L1) Potential

−2 0 2−3

−2

−1

0

1

2

3

Total Variation (L1) Influence

|∆|pp

Bouman & Sauer[13]“Generalized GaussianMRF”

−2 0 20

1

2

3Generalized Gaussian Potential

−2 0 2−3

−2

−1

0

1

2

3Generalized Gaussian Influence

∆2

2 for |∆|<T

T |∆|− T 2

2 for |∆|≥T

Stevenson & Delp[63]“Huber function”

−2 0 20

1

2

3Huber Function Potential

−2 0 2−3

−2

−1

0

1

2

3Huber Function Influence

T 2 log cosh

|∆|T

Green [32]

−2 0 20

1

2

3log cosh Potential

−2 0 2−3

−2

−1

0

1

2

3log cosh Influence

|∆|pp

( |∆/T |q−p

1 + |∆/T |q−p

) Thibault, Sauer,Bouman, & Hsieh[64]“Q-Generalized GMRF”

−2 0 20

1

2

3Q−Generalized Gaussian Potential

−2 0 2−3

−2

−1

0

1

2

3Q−Generalized Gaussian Influence

Figure 6.4: List of the potential and influence functions for a variety of convex po-tential functions for T = 1 and shape parameters p = 1.2 and q = 2.

Over the years, a wide variety of convex potential functions have beenproposed with a correspondingly wide range of practical and theoretical ad-vantages and disadvantages to consider. Figure 6.4 shows a representative

Page 129: Model Based Image Processing (Text)

6.3 Convex Potential Functions 119

subset of these functions, although there are many more.

Of course, the simplest choice of potential function is the quadratic, ρ(∆) =∆2, which results in the Gaussian MRF model that was the subject of Chap-ter 4. While this model has the advantage of being the most analyticallytractable, its primary disadvantage is that it does not accurately characterizethe sharp discontinuities that typically occur in images and other real signals.

One of the earliest and most interesting alternative potential functions isthe absolute value function initially proposed by Besag [9], which is sometimesreferred to as a L1 norm regularizer. In this case, the potential function isgiven by

ρ(∆) = |∆| , (6.10)

with associated influence function

ρ′(∆) = sign(∆) . (6.11)

This potential function has the advantages that it is convex; it does not growas quickly as a quadratic function, so it is edge preserving; and it does notrequire the choice of a specific T parameter that determines the value of ∆that will likely occur across edges.

The absolute value potential function represents a special case because itis convex, but not strictly convex; and because it has a discontinuous secondderivative at 0. This results in many very unique properties to the MAPestimate. For example, because the MAP cost function is not continuouslydifferentiable, gradient based algorithms such as gradient descent, conjugategradient and ICD are generally not convergent when used with the abso-lute value potential function, and more complex optimization algorithms arerequired that often are not guaranteed to achieve the global minimum [57].

We should note that the absolute value potential function is very closelyrelated to the total variation regularization of [56] in which image esti-mates are regularized using the integral of the gradient magnitude. The totalvariation norm is defined for continuous functions on R

2 by

TV (x) =

R2

|∇x(r)|dr .

But of course in applications, it is necessary to discretely sample the functionx(r). So the TV norm can be discretely approximated, using a rectangular

Page 130: Model Based Image Processing (Text)

120 Non-Gaussian MRF Models

sampling lattice, by either the isotropic total variation given by

TV (x) =∑

i,j

(xi+1,j − xi,j)2 + (xi,j+1 − xi,j)

2 , (6.12)

or the anisotropic total variation given by

TV (x) =∑

i,j

|xi+1,j − xi,j|+ |xi,j+1 − xi,j| . (6.13)

Notice that the anisotropic total variation of (6.13) is a special case of thepair-wise Gibbs distribution with the absolute value potential function. How-ever, as the name implies, the anisotropic total variation of (6.13) does notaccurately approximate the total variation for all orientations of the gradient.Nonetheless, its simplified form sometimes has computational advantages.

Figure 6.5 illustrates what typically happens when absolute value poten-tials are used. Notice that the minimum of the cost function typically fallsalong these edges of discontinuity. Since the edges of discontinuity occur with|xr − xs| = 0 or equivalently, xr = xs, the MAP estimate tends to containgroups of neighboring pixels that are of equal value. This means that theabsolute value potential tends to produce large flat regions with sharp transi-tions. In some cases, this may be good, but in other cases, these flat regionscan appear artificial and are often described as “waxy” by naive observers.

xr

f(xs, xr; y)

xs

xs = xr

xMAP = arg minxs,xr

f(xs, xr; y)

Figure 6.5: Figure showing a typical MAP cost function resulting from the use of aabsolute value potential function (i.e., total variation regularization). Notice that thecost function is convex, but that it is not continuously differentiable, so that the min-imum of the cost function typically occurs at a point of discontinuity correspondingto xs = xr where r ∈ ∂s.

In some applications, this tendency of the absolute value potential functionor L1 norm log prior model to drive values to zero can be quite useful. For ex-

Page 131: Model Based Image Processing (Text)

6.3 Convex Potential Functions 121

ample, the least absolute shrinkage and selection operator (LASSO)uses this property of the L1 norm to drive model parameter values to 0,thereby reducing model order [65].

However, in other applications, the L1 norm’s tendency to zero out reg-ularized quantities can result in image artifacts; so in these applications, aless severe regularizing potential function is needed. There are two basic ap-proaches to addressing this limitation of absolute value prior models. Oneapproach is to generalize the L1 norm to an Lp norm, and a second approachis to “round out” the bottom of the L1 norm by making it quadratic for|∆| << 1.

An example of the first approach is the potential function used for theGeneralized Gaussian MRF (GGMRF) [13]. In this case, the potentialfunction is given by

ρ(∆) =|∆|pp

, (6.14)

with associated influence function

ρ′(∆) = |∆|p−1sign(∆) . (6.15)

For p > 1 this potential function is strictly convex and continuously differ-entiable; so gradient based algorithms can achieve a global minimum of thecost function. In addition, these potential functions have the advantage that,as with the case of the absolute value potential, there is no longer an explicitvalue of T to choose, but there is instead a general shape parameter p. Inpractice, p is often chosen to be in the range of 1.1 to 1.2.

Another approach to generalizing the absolute value potential is to roundout the point of the function by using a local quadratic near ∆ = 0. Perhapsthe best example of this approach is theHuber function [63]. This potentialfunction is given by

ρ(∆) =

∆2

2 for |∆| < T

T |∆|− T 2

2 for |∆| ≥ T ,(6.16)

with associated influence function

ρ′(∆) = clip∆, [−T, T ] , (6.17)

where the function clipx, [a, b] simply clips the value x to the interval [a, b].The Huber function has the advantage that near ∆ = 0 it maintains many

Page 132: Model Based Image Processing (Text)

122 Non-Gaussian MRF Models

of the properties of the GMRF. This can be very important because theimages generated with Huber function potentials tend to better maintainlow-contrast details, and they also result in MAP cost functions that aremore amenable to optimization. However, the Huber function does havesome disadvantages. First, it again requires the choice of a threshold T .Second, for values of |∆| > T , the function is not strictly convex, so theglobal minimum of the MAP cost function may not be unique; and finally,the function does not have a continuous second derivative at |∆| = T . Thislast disadvantage is easily addressed by a wide variety of alternative potentialfunctions which are approximately quadratic at ∆ = 0, and approximatelylinear as |∆| → ∞. One such example is the function

ρ(∆) = T 2 log cosh

( |∆|T

)

, (6.18)

with associated influence function

ρ′(∆) = T tanh

( |∆|T

)

, (6.19)

where again the constant T is introduced to control the placement of thetransition from quadratic to linear behavior [32].

Finally, the Q-Generalized GMRF (QGGMRF) is a generalization ofthe GGMRF potential function that allows for parameters to control boththe low-contrast character of the function when ∆ ≈ 0, and the high-contrastcharacter as |∆| → ∞ [64]. The QGGMRF potential function is given by

ρ(∆) =|∆|pp

(∣

∆T

q−p

1 +∣

∆T

q−p

)

(6.20)

and its associated influence function is given by

ρ′(∆) = |∆|p−1∣

∆T

q−p (qp +

∆T

q−p)

(

1 +∣

∆T

q−p)2sign(∆) (6.21)

where p and q are chosen so that 1 ≤ p < q in order to ensure that thefunction is convex.4 Along high contrast edges, when |∆| > T , the shape

4 Our definition of the QGGMRF swaps the roles for the variables q and p relative to the form used in[64].

Page 133: Model Based Image Processing (Text)

6.4 Scaling Parameters for Non-Gaussian MRFs 123

of the QGGMRF is approximately the same as the GGMRF with ρ(∆) ≈|∆|pp . However, in low-contrast regions when |∆| < T , then the potential

function is approximately given by ρ(∆) ≈ |∆|qpT q−p . In a typical application,

one might choose q = 2 and 1 ≤ p < q. In this case, the potential functionis quadratic near ∆ = 0 and is ensured to have a continuous first and secondderivative. Notice that this is not the case for the function |∆|p, which has anunbounded second derivative near ∆ = 0 when 1 ≤ p < 2. Later we will seethat a continuous second derivative is a valuable property in optimization,particularly when using the majorization techniques of Chapter 8.

6.4 Scaling Parameters for Non-Gaussian MRFs

In practical problems, it is almost always necessary to scale the range of valuesfor a MRF model. So for example, if an MRF, X, represent a conventionalraster image, then the values, Xs, should fall in a range from 0 to 255.However, if X is being used to represent ocean depth in meters, then a rangeof 0 to 11,000 might be more appropriate. So for each physical phenomena,we must be able to scale the typical range of values in a MRF model, withoutnecessarily changing the basic characteristics of the model.

To do this, we can introduce a scaling parameter, σx, to the pair-wise Gibbsdistribution of equation (6.5). We do this by directly scaling the values insidethe potential functions of the Gibbs distribution.

p(x|σx) =1

zexp

−∑

s,r∈Pbs,rρ

(

xs − xrσx

)

Using this convention, notice that if X has distribution p(x|σx), then X =X/σx must have a distribution given by p(x|σx = 1).

Even though parameter estimation for MRFs is known to be a classicallydifficult problem, estimation of the scale parameter, σx, is more tractablethen one might imagine. This is because the partition function, z, turnsout to be a simple function of σx. In fact, by applying standard resultsfrom multidimensional integration, it can be shown (See problem 5) that thepartition function must have the form

z(σx) = z0 σNx ,

Page 134: Model Based Image Processing (Text)

124 Non-Gaussian MRF Models

where z0 is a constant. Using this result, we can express the ML estimate ofσx as

σx = argminσx>0u(x/σx) +N log(σx) + log(z0) ,

where u(x) is the Gibbs distribution’s energy function given by

u(x) =∑

s,r∈Pbs,rρ(xs − xr) .

By setting the derivative to zero, we can express the ML estimate as thesolution to the following equation.

σxN

d

dσxu(x/σx)

σx=σx

= −1 (6.22)

In fact, this equation is only a function of a single variable, σx; so it maybesolved numerically for a particular image x by using any rooting algorithm.

Name Potential Function ρ(∆) Influence Function ρ′(∆)

Quadratic∆2

2σ2x

σ2x

TotalVariation

|∆|σx

sign(∆)

σx

Huber

∆2

2σ2x

for |∆|<Tσx

T∣

∆σx

∣− T 2

2 for |∆|≥Tσx

1

σ2x

clip∆, [−Tσx, Tσx]

log cosh T 2 log cosh

(

Tσx

)

T

σxtanh

(

Tσx

)

GGMRF|∆|ppσp

x

|∆|p−1

σpx

sign(∆)

QGGMRF|∆|ppσp

x

∆Tσx

q−p

1 +∣

∆Tσx

q−p

|∆|p−1

σpx

∆Tσx

q−p(

qp +

∆Tσx

q−p)

(

1 +∣

∆Tσx

q−p)2 sign(∆)

Table 6.1: Analytical expressions for a number of convex potential functions andtheir associated influence function. Each potential function is parameterized by ascale parameter, σx, and a threshold parameter, T . The scale parameter changes therange of values in X, and the threshold parameter determines the point of transitionin the potential functions.

However, in some cases, it is even possible to find a closed form solutionto the ML estimate. Consider the case when u(αx) = αpu(x), then it can

Page 135: Model Based Image Processing (Text)

6.4 Scaling Parameters for Non-Gaussian MRFs 125

be shown that for this case (See problem 6) the ML estimate has the closedform given by

σx =( p

Nu(x)

)(1/p)

.

For the specific case of the GGMRF of equation (6.14), the distribution isthen given by

p(x|σx) =1

zexp

− 1

pσpx

s,r∈Pbs,r|xs − xr|p

;

so the ML estimate of σx has the closed form given by

σpx =

1

N

s,r∈Pbs,r|xs − xr|p . (6.23)

Notice, that the very simple form of equation (6.23) is reminiscent of theexpression for the variance of a Gaussian random variable, except that thesum is over all cliques and the differences are raised to the power p ratherthan simply squared.

The setting of the single parameter σx can be a major practical concernwhen using p(x) as a prior model in, say, MAP estimation. If σx is too large,then the image will be “under regularized” or in other words, it will over-fitthe measured data and have too much noisy variation. Alternatively, if σx istoo small, the image will be “over regularized” and important detail may beremoved due to over smoothing.

For notational simplicity, we can just include this parameter, σx, in thedefinition of the potential function. So for example, in the quadratic case thepotential function becomes

ρ(∆) =1

2

σx

2

=∆2

2σ2x

and its associated influence function becomes

ρ′(∆) =∆

σ2x

.

Using this approach, Table 6.1 lists out the potential and influence functionsfor a number of the convex potential functions discussed in the previous

Page 136: Model Based Image Processing (Text)

126 Non-Gaussian MRF Models

section. Notice, that the transition point between the low and high contrastbehaviors now occurs at the value σxT , rather than just T . This is usefulsince it means that the units of T are automatically scaled to the physicalrange of the data based on the choice of σx.

Page 137: Model Based Image Processing (Text)

6.5 Chapter Problems 127

6.5 Chapter Problems

1. Prove Property 6.1 by showing that equation (6.2) holds for any sym-metric matrix B ∈ R

N×N and any vector x ∈ RN . (Hint: It is enough

to show that the equality holds for x = 0 and that the gradients of thetwo expressions are equal for all x.)

2. Let B be the precision matrix (i.e., the inverse covariance) of a zero-mean GMRF with pair-wise cliques P . Then prove that equation (6.3)holds for any vector x ∈ R

N . (Hint: Prove that equations (6.2) and (6.3)are equal by showing the following three facts:

For all s, r 6∈ P , Bs,r = 0.

For s = r, the term bs,r|xs − xr|2 = 0.

For all s 6= r, the term bs,r|xs − xr|2 appears twice in the sum of(6.2) and only once in the sum of (6.3).

)

3. Show that if X is a zero-mean Gaussian random vector with inverse co-variance, B, then Bs,r = 0 if and only if Xs is conditionally independentof Xr given Xi : for i 6= s, r.

4. Show that if X is distributed as equation (6.5), then the conditionaldistribution of Xs given Xr for r 6= s is given by equation (6.7).

5. Let X ∈ RN have a Gibbs distribution with the form

p(x|σ) = 1

zexp

−∑

s,r∈Pbs,rρ

(

xs − xrσ

)

.

Then prove that the partition function is given by

z(σ) =

RN

exp

−∑

s,r∈Pbs,rρ

(

xs − xrσ

)

dx

= z0 σN ,

where z0 is a constant.

Page 138: Model Based Image Processing (Text)

128 Non-Gaussian MRF Models

6. Prove that for a Gibbs distribution with the form

p(x|σ) = 1

zexp −u(x/σ) .

with an energy function u(x) of the form

u(x/σ) =1

pσp

s,r∈Pbs,r|xs − xr|p ,

then the ML estimate of the parameter σ is given by

σp =1

N

s,r∈Pbs,r|xs − xr|p .

Page 139: Model Based Image Processing (Text)

Chapter 7

MAP Estimation with Non-GaussianPriors

The non-Gaussian prior models introduced in the previous chapter have thepotential to improve image quality in applications such as image restorationand reconstruction. However, these non-Gaussian priors also require newmethods for non-quadratic optimization so that the MAP estimate can becomputed.

In this chapter, we introduce some of the basic tools that are commonlyused for computing the solution to the non-quadratic optimization problemsresulting from MAP estimation with non-Gaussian models. First, we will seethat convexity is a powerful tool for ensuring that the MAP estimation prob-lem has a unique and computable solution, and we will begin to understandthe importance of efficient line-search algorithms when solving the large con-vex optimization problems that often arise in MAP optimization. However,even with these tools, we will see that computing updates for algorithmssuch as gradient descent, ICD, and conjugate gradient can be numericallydemanding, which will lead us to the majorization minimization algorithmspresented in Chapter 8.

7.1 The MAP Cost Function and Its Properties

In a typical inverse application, our objective is to estimate an image, X ∈R

N , with prior distribution p(x) from a vector of measurements, Y ∈ RM ,

with conditional density py|x(y|x). It is also very common to have physical

Page 140: Model Based Image Processing (Text)

130 MAP Estimation with Non-Gaussian Priors

properties that restrict the image to a convex set Ω ⊂ RN . For example, in

many physical problems we know that the solution must by non-negative, sowe would like to enforce a positivity constraint when solving the problem.To do this, we first define the set R+ = x ∈ R : x ≥ 0, and then the convexset is given by

Ω = R+N =

x ∈ RN : xi ≥ 0 for all i

. (7.1)

Using this framework, the MAP estimate of X given Y is given by

x = argminx∈Ω

f(x; y) , (7.2)

where we will refer to the function f(x; y) as the MAP cost function givenby

f(x; y) = − log py|x(y|x)− log p(x) . (7.3)

So the three key steps required for MAP estimation are:

1. Select the forward model py|x(y|x);2. Select the prior model p(x);

3. Minimize the cost function.

In principle, only steps 1 and 2 determine the quality of the MAP estimate,and the choice of optimization procedure only effects the computation re-quired to compute the estimate. However, in practice if the optimizationmethod does not achieve the exact global minimum of the MAP cost func-tion (which is typically the case), then step 3 will also have some impact onthe quality of the solution.

Convexity of the MAP cost function, f(x; y), as a function of x will be avery powerful concept in understanding the existence, uniqueness, and stabil-ity of the MAP estimate.1 Appendix A provides a review of convex functionsand sets, and it also provides some basic results on how convexity can beused to ensure existence and uniqueness of minima in general, and the MAPestimate in particular. Loosely speaking, the key results are that, for a con-vex function, any local minimum must also be a global minimum; and for astrictly convex function, any global minimum must be unique.

1Existence, uniqueness, and stability are the three properties of a well-posed inverse as defined byTikhonov[66].

Page 141: Model Based Image Processing (Text)

7.1 The MAP Cost Function and Its Properties 131

1x x2

location ofminimum

1 2x x

location ofminimum

a) b)

Figure 7.1: Illustration of how a non-convex MAP cost function can lead to an un-stable MAP estimate. Figures a) and b) show very slight perturbations of the MAPcost function corresponding to slightly different values of y. While the functions onlyvary slightly, the MAP estimate varies discontinuously jumping from one side to theother.

This is very important because most practical optimization techniques,such as the gradient-based methods of Chapter 5, converge at best to a localminimum of a cost function. So convexity of the MAP cost function ensuresthat practical optimization methods can result in a true (but perhaps non-unique) MAP estimate. Strict convexity further ensures that the resultingMAP estimate is unique.

While the MAP estimate may exist, it may not always have desirable prop-erties. For example, Figure 6.3 of Section 6.3 provides an example where theMAP estimate behaves discontinuously. In some applications, this discon-tinuous behavior may be desirable, but in many applications, where X is animage that must be restored, discontinuous behavior of the MAP estimatecan introduce artifacts into the image.

Figure 7.1 graphically illustrates the problem that can occur with non-convex potential functions. Figures 7.1 a) and b) illustrate the two MAPcost functions corresponding to two values of y that are only slightly different.While the MAP cost functions shift only slightly, the locations of the globalminimum for each function can change discontinuously. This causes the MAPestimate to discontinuously jump from one side to the other. Intuitively, thisis the reason for the discontinuous change in the MAP estimate as shown inFigure 6.3.

A strictly convex MAP cost function eliminates this potentially undesir-able behavior by insuring that the MAP estimate is a continuous function of

Page 142: Model Based Image Processing (Text)

132 MAP Estimation with Non-Gaussian Priors

the data y. The following theorem makes this statement more precise [13].

Theorem 7.1.1. Stability/Continuity of MAP EstimatesLet the MAP cost function, f(x; y), be a continuous function of (x, y) ∈Ω×R

M ; and for all y ∈ RM , let f(·, y) be a strictly convex function of x ∈ Ω

with a local minimum. Then the MAP estimate is a unique and continuous(i.e., stable) function of the data y.

This raises the question of what conditions will ensure convexity of theMAP cost function? In order to provide a practical answer to this question,we will consider a slightly more general example than the one considered inChapter 5. Let us assume that Y ∈ R

M has the form

Y = AX +W , (7.4)

where W ∈ RM is assumed to be independent zero-mean additive Gaussian

noise with distribution N(0,Λ−1), X ∈ RN , and A is an M × N matrix.

Typically, the inverse covariance Λ is diagonal because the noise for eachscalar observation is independent; however, this is not absolutely necessaryfor the formulation of our problem. In addition, it may happen that M > N ,M < N , or M = N depending on the specific experimental scenario.

Given this framework, the likelihood of the observations, Y , given theunknown, X, has a form similar to equation (5.3).

py|x(y|x) =1

(2π)M/2|Λ|1/2 exp

−12||y − Ax||2Λ

(7.5)

In addition, we assume that X is an MRF, so that the prior is given by apair-wise Gibbs distribution similar to that of equation (6.5),

p(x) =1

zexp

−∑

s,r∈Pbs,rρ(xs − xr)

, (7.6)

where in this case the potential function ρ(∆) includes the scaling constantσx as shown in Table 6.1 of Section 6.4. Putting the forward and prior modelsinto equation (7.3), we get the MAP cost function of

f(x; y) =1

2||y − Ax||2Λ +

s,r∈Pbs,rρ(xs − xr) . (7.7)

Page 143: Model Based Image Processing (Text)

7.2 General Approaches to Optimization 133

From the properties of convex functions given in Appendix A, it is clear thatif ρ(∆) is a convex function, then f(x; y) is a convex function of x ∈ Ω.Moreover, if the rank of A is at least N , then the function being minimizedis strictly convex. However, even when A is not rank N , the function willtypically be strictly convex as long as A1 6= 0 where 1 denotes a columnvector of 1’s. The following property makes this statement more precise.

Property 7.1. Conditions for strict convexity of the MAP cost function - Letf(x; y) be defined as in (7.7) where x ∈ Ω ⊂ R

N , y ∈ RM , Λ is a positive-

definite matrix, bs,r ≥ 0 for all s, r ∈ S, and Ω is a convex set. Thenf(x; y) is a strictly convex function of x ∈ Ω and a continuous function of(x, y) ∈ Ω× R

M when either one of the following two conditions hold.

Condition 1: A has rank N ; and ρ(∆) is convex on R

Condition 2: A1 6= 0; ∀s ∃r s.t. bs,r > 0; and ρ(∆) is strictly convex onR.

In practice, the second condition of Property 7.1 typically holds in applica-tions as long as the potential functions are strictly convex.

7.2 General Approaches to Optimization

Once we have selected appropriate forward and prior models, the challengebecomes to accurately compute the MAP estimate through computationallyefficiently minimization of the MAP cost function.

x = argminx∈Ω

f(x) (7.8)

In this chapter, we will be primarily concerned with the problem of convexoptimization in which Ω is a closed convex set and f(x) is a convex function.Then from Theorem A.0.2 of Appendix A we know that any local minimumwill be a global minimum. Moreover, if the function f(x) is strictly convex,than any such global minimum will be unique.

Now it may happen that no local or global minimum exists for the problemof (7.8). For example, Figure A.1 shows a simple function f(x) = e−x thathas no local minimum on R. We can ensure the existence of a local minimumby adding the assumption that Ω is a compact set, i.e., that it is closed and

Page 144: Model Based Image Processing (Text)

134 MAP Estimation with Non-Gaussian Priors

bounded. However, in many cases the MAP cost function will take values onR

N or R+N , which are not bounded and therefore not compact. In order tohandle these cases, we will typically assume that the function has a compactsublevel set as defined in Appendix A. In this case, there is an α ∈ R suchthat the sublevel set given by

Aα =

x ∈ RN : f(x) ≤ α

is compact and non-empty. Using this definition, it is easily shown thatany strictly convex function with a compact sublevel set has a unique globalminimum. (See Problem 2)

In some cases, the set Ω will enforce constraints that can make optimiza-tion more difficult. If x lies in the interior of Ω and f(x) is continuouslydifferentiable, then the familiar condition for a minimum is that

∇f(x)|x=x = 0 .

However, things get more complicated when x lies on the boundary of Ω. Inthis case, the Karush-Kuhn-Tucker (KKT) conditions provide a gener-alization of this familiar condition. Moreover, in Chapter 9 we will introducethe theory of Lagrange multipliers as a general approach to solving con-strained optimization problems, and we will see that these techniques canalso be extremely useful in solving MAP optimization problems when f(x) isnot differentiable everywhere.

The constraint that typically arises in real imaging problems is positivity.Physically, we often know that xs must be non-negative because it representsa non-negative physical quantity such as light emission, photon absorption,or density. In practice, the positivity constraint can provide quite a bit ofuseful information by effectively reducing the number of unknown variablesin a problem when they hit the constraint of zero. Fortunately, the set ofpositive images, x ∈ R

+N , is a convex set; so the problem remains one ofconvex optimization.

With this background in mind, let us first consider the problem of uncon-strained optimization when x ∈ R

N . Most iterative optimization algorithmsstart with an initial value x(k) and then update the value in an attempt tominimize the function f(x). As we saw in Chapter 5, this update step typ-ically has the form of a line search in which the function f(x) is searched

Page 145: Model Based Image Processing (Text)

7.2 General Approaches to Optimization 135

General Optimization Approach:

Initialize x(0) ∈ RN

For k = 1 to K // Calculate direction d ∈ R

N

d← FavoriteOptimizationAlgorithm(

f(·), x(k−1))

// Perform line search

α∗ ← argminα∈R

f(

x(k−1) + αd)

// Update solution

x(k) ← x(k−1) + α∗d

Figure 7.2: This figure provides a pseudocode specification for a general class ofnon-quadratic optimization algorithms. The structure is used by many optimizationalgorithms including gradient descent with line search, ICD, and conjugate gradient.

along a line in the direction d passing through the initial point x(k). Thesearch line can be represented as x = x(k−1)+αd where d ∈ R

N is the chosendirection and α ∈ R is a scalar that parameterizes the movement along theline. Algorithmically, the line search update is then given by

α∗ = argminα∈R

f(x(k−1) + αd) (7.9)

x(k) = x(k−1) + α∗d

where the first step searches along a line, and the second step updates thevalue of x. We can also represent this line search operation as a functionx(k) = LineSearch(x(k−1); d).

Our hope is that after repeated application of line search that we willconverge to a local or global minimum of the function f(x). We can makethis thinking a bit more precise by defining the concept of a fixed point.We say that x∗ is a fixed point of the function LineSearch(·; d) if x∗ =LineSearch(x∗; d), i.e., the line-search operation returns its initial value.Then x∗ is a global minimum of f(x) if and only if x∗ is a fixed point ofthe function LineSearch(·; d) for all directions d ∈ R

N .

Figure 7.2 provides a pseudocode specification of this general optimizationframework. First the direction d is determined. Next, a line search is per-formed to find the value of α ∈ R that minimizes the function f(x(k) + αd).

Page 146: Model Based Image Processing (Text)

136 MAP Estimation with Non-Gaussian Priors

General ICD Optimization Approach:

For K iterations For each pixel s ∈ S

α∗ ← arg minα≥−xs

f(x+ αεs)

xs ← xs + α∗

Figure 7.3: This figure provides a pseudocode specification for the general ICD orequivalently Gauss-Seidel update algorithm. One full iteration requires the sequen-tial update of each pixel. ICD works well with positivity constraints, and when f(x)is continuously differentiable and convex then ICD updates converge to a global min-imum when it exists.

Once the optimum value α∗ is determined, the new value of x(k+1) is com-puted, and the entire process is repeated until the desired level of convergenceis achieved. In practice, line search is common to many optimization algo-rithms; and for non-quadratic optimization problems, it tends to represent akey computational burden in the overall optimization procedure. So efficientimplementation of line search is very important.

In the case of the steepest descent algorithm of Section 5.3.3, the directionis chosen to be in the opposite direction of the gradient, d = −∇f(x). In theconjugate gradient algorithm of Section 5.5, the negative gradient directionis adjusted to be conjugate to all previous update directions. The ICD opti-mization algorithm of Section 5.4 is an interesting special case in which eachnew update is taken to be in the direction of a single pixel. So in this case,d = εs, where εs ∈ R

N is a vector whose sth component is 1, and remainingcomponents are 0.

The ICD algorithm, which is also known as Gauss-Seidel iterations, willbe of particular value and interest to us. A single full ICD iteration consistsof one update for each pixel in a fixed sequential order. So we may representthat in the following algorithmic form.

For s ∈ S (7.10)

α∗ ← argminα∈R

f(x+ αεs) (7.11)

x ← x+ α∗εs

Page 147: Model Based Image Processing (Text)

7.2 General Approaches to Optimization 137

In fact, the ICD algorithm we have studied is guaranteed to converge to theglobal minimum under some fairly general conditions. The following theoremstates this result more precisely.

Theorem 7.2.1. ICD ConvergenceLet f : Ω→ R be a strictly convex and continuously differentiable function onthe convex set Ω ⊂ R

N . Then the ICD iterations of equation (7.10) convergeto the global minimum of f .

Proof. See for example Proposition 3.9 page 219 of [5].

However, while this result appears to be strong, the limitation to con-tinuously differentiable functions is a practical restriction. If the functionis convex but not differentiable, then the ICD algorithm can routinely failto converge. For example, when using the total variation regularization ofSection 6.3, the MAP cost function is not continuously differentiable, so theICD algorithm will typically stall before reaching the global minimum. TheProblems 9 and 4 at the end of this chapter present two examples of the ap-plication of ICD to functions that are not continuously differentiable. In thefirst problem, ICD can be shown to converge to the global minimum, whilein the second problem it stalls.

One important advantage of ICD is that positivity is easily enforced bysimply restricting each update to take on a non-negative value. In this case,the ICD optimization procedure is given by

xs ← xs + arg minα≥−xs

f(x+ αεs) ,

where εs is a vector which is 1 at its sth coordinate and zero elsewhere.Figure 7.3 shows a pseudo-code specification of the general ICD optimizationalgorithm with positivity constraints.

If the function f(x) is continuously differentiable and convex, then thesolution to the optimization problem with positivity constraints can be ex-pressed using the KKT conditions. In this case, the KKT conditions reduceto the simple form.

∀s ∈ S such that x∗s 6= 0∂f(x∗)

∂xs= 0

Page 148: Model Based Image Processing (Text)

138 MAP Estimation with Non-Gaussian Priors

∀s ∈ S such that x∗s = 0∂f(x∗)

∂xs≥ 0 .

So in this case, the function takes on its global minimum at x∗ if andonly if the derivative for each coordinate is either zero or positive, and it canonly be positive for coordinates that fall on the boundary of the positivityconstraint.

Using these simplified KKT constraints, it is easily shown that x∗ achievesa global minimum of a convex function if and only if it is a fixed point of theICD algorithm. So once again, the ICD algorithm is globally convergent forthe minimization of continuously differentiable convex functions with positiv-ity constraints. This is an important property because other methods, suchas gradient decent have difficulty with positivity constraints.

In Chapter 9, we will treat the broader problem of constrained optimiza-tion in the framework of Lagrange multipliers, and we will introduce somegeneral methods such as variable splitting and the ADMM algorithm that willprovide convergent methods for solving a wide range of convex optimizationproblems.

7.3 Optimization of the MAP Cost Function

Now that we have presented some of the basic strategies behind optimization,consider how these ideas can be applied to the specific MAP cost function ofequation (7.7). For this problem, the line search function has the form

f(x+ αd) =1

2||y − Ax− αAd||2Λ +

s,r∈Pbs,rρ(xs − xr + α(ds − dr))

=1

2||e− αAd||2Λ +

s,r∈Pbs,rρ(∆xs,r + α∆ds,r) , (7.12)

where e , y − Ax, ∆xs,r , xs − xr, ∆ds,r , ds − dr, and we suppress thedependence on the data, y, for notational clarity. Now since, in this case,the log likelihood term has a quadratic form, equation (7.12) can be morecompactly expressed as a simple quadratic function of the scalar value α.We can do this by simply computing the first two terms of the Taylor seriesexpansion, which in this case, will be an exact representation of the true log

Page 149: Model Based Image Processing (Text)

7.3 Optimization of the MAP Cost Function 139

likelihood. This results in the following simpler expression for the MAP costfunction

f(x+ αd) = c+ θ1α +1

2θ2α

2 +∑

s,r∈Pbs,rρ(∆xs,r + α∆ds,r) (7.13)

where

θ1 = −etΛAd (7.14)

θ2 = dtAtΛAd , (7.15)

where e = y−Ax. So our objective is then to minimize this function over α,and then to use this minimized value to update x. The optimal value of α isthen given by

α∗ = arg minα∈[a,b]

f(x+ αd) (7.16)

= arg minα∈[a,b]

θ1α +1

2θ2α

2 +∑

s,r∈Pbs,rρ(∆xs,r + α∆ds,r)

(7.17)

where [a, b] is the interval over which α can vary. For example, in gradientdescent [a, b] = [0,∞]. However, in practice it is usually possible to findtighter limits which result in a bounded interval. Once the value of α∗ iscomputed, then the value of x is updated,

x← x+ α∗d ,

and the entire optimization procedure is repeated until sufficient convergenceis achieved.

The following example considers the special case of ICD optimization andderives an efficient algorithm for computing the required updates.

Example 7.1. In order to illustrate the concept of non-quadratic line search,consider the example of ICD updates with a non-quadratic log prior model.Referring back to Section 5.4, we see that the update direction for ICD isgiven by d = εs, where εs is a vector that is 1 for element s, and 0 otherwise.Using this fact, and the update equations of (7.14) and (7.15), we get thefollowing values of θ1 and θ2,

θ1 = −etΛAεs = −etΛA∗,s (7.18)

θ2 = εtsAtΛAεs = At

∗,sΛA∗,s , (7.19)

Page 150: Model Based Image Processing (Text)

140 MAP Estimation with Non-Gaussian Priors

where A∗,s is the sth column of the matrix A.

Remember that for ICD, the value of α only changes the value of the onepixel xs. So the only terms that need to be considered are terms that containxs in them. Therefore, we have the following relationship.

s,r∈Pbs,rρ(∆xs,r + α∆ds,r) =

r∈∂sbs,rρ(∆xs,r + α) + constant

So using equation (7.17), we get the following ICD update equation for thesth pixel,

α∗ = arg minα≥−xs

θ1α +1

2θ2α

2 +∑

r∈∂sbs,rρ(xs − xr + α)

, (7.20)

where the constraint that α ≥ −xs enforces that the updated pixel is positive.Of course, the optimization of equation (7.20) is not straightforward for mostnon-quadratic potential functions, ρ(·); but for now, let us assume that this1-D optimization can be solved. The resulting value of α∗ is then used toupdate both the pixel’s value and the error vector e with the following updateequations.

xs ← xs + α∗

e ← e− Aεsα∗ = e− A∗,sα

Figure 7.4 provides a pseudocode summary of this procedure for ICD opti-mization with a non-quadratic prior model.

The question remains of how to efficiently compute the line search of equa-tions (7.17) or (7.20). Notice that, in this form, the likelihood term is reducedto a very simple quadratic expression, so this is easily handled; but the priorterm still depends on the non-quadratic potential functions. If the poten-tial functions are continuously differentiable, then one simple way to find theminimum is to root the derivative of the function, in other words, to computethe value of α∗ that makes the following equation true.

g(α) ,∂

∂αf(x+ αd)

= θ1 + θ2α +∑

s,r∈Pbs,rρ

′(∆xs,r + α∆ds,r)∆ds,r

= 0 ,

Page 151: Model Based Image Processing (Text)

7.3 Optimization of the MAP Cost Function 141

ICD Algorithm for Non-Quadratic Prior:

Initialize e← y − AxFor K iterations

For each pixel s ∈ S θ1 ← −etΛA∗,s

θ2 ← At∗,sΛA∗,s

α∗ ← arg minα≥−xs

θ1α +1

2θ2α

2 +∑

r∈∂s

bs,rρ (α + xs − xr)

xs ← xs + α∗

e ← e− A∗,sα∗

Figure 7.4: Pseudocode for a fast implementation of the ICD algorithm with a non-quadratic prior term. The speedup depends on the use of a state variable to store theerror, e = y − Ax. The resulting line search can be solved using a variety of rootingmethods, such as half-interval search, or the surrogate function methods of Chapter 8

Half Interval Line-Search Algorithm:

Initialize a and b so that g(a) < 0 and g(b) > 0.

For k = 1 to K c← (a+ b)/2

If g(c) ≤ 0, then a← c

If g(c) > 0, then b← cα∗ = −g(a)

g(b)−g(a)(b− a) + a

Figure 7.5: This figure provides a pseudocode specification of half-interval line search.The algorithm requires an initial specification of the search interval, [a, b], and thenit iteratively halves the interval to reduce the uncertainly of the solutions.

where ρ′(∆) is the influence function formed by differentiating the potentialfunction. If the potential functions are strictly convex, then g(α) will be astrictly increasing function of α. So if we can find an interval so that g(a) < 0and g(b) > 0, then the root must lie somewhere between these two limits.

There are many well known methods for efficiently rooting an equation ofa scalar variable, but perhaps the most intuitive is the half interval searchmethod. Figure 7.5 shows a pseudocode specification of half interval search.

Page 152: Model Based Image Processing (Text)

142 MAP Estimation with Non-Gaussian Priors

The idea is a simple one. With each iteration, g(c) is evaluated where c =(b+ a)/2 is the half way point between a and b. Then if g(c) ≤ 0, the pointc is taken as the new left hand end of the search interval; and if g(c) > 0,then c is taken as the new right hand end of the interval. After K iterations,the algorithm is guaranteed to have achieved an accuracy of at least b−a

2K .Notice that the last step performs an interpolation of the function in orderto estimate the location of the root. If the function is smooth, then this stepcan greatly improve the rooting accuracy.

However, half interval search has a number of disadvantages. First, itrequires that a finite interval, [a, b], for the solution be known in advance.There are a number of practical approaches to solving this problem. Oneapproach is to first check the values of g(a) and g(b). If both g(a) < 0 andg(b) < 0, then a ← b can be taken as the new left-hand value, since it isthe better of the two solutions, and the value of b can be increased. Thisprocess can then be repeated until g(b) > 0. A similar approach can be takenif g(a) > 0 and g(b) > 0. In this case, b← a and a is decreased.

Perhaps a more serious disadvantage of half-interval search is that it re-quires repeated evaluation of the function g(α). Typically, evaluation of g(α)requires significant computation, so this may represent an unacceptable com-putational overhead. This overhead can be reduced by the judicious designof a line search algorithm which converges in a small number of iterations.Furthermore, it is important that with each iteration the value of the costfunction, f(x+αd), is monotonically decreased from its starting value, f(x).This ensures that, even if the iterations are terminated early, the cost functionwill still be reduced. The following chapter presents such an approach.

Page 153: Model Based Image Processing (Text)

7.4 Chapter Problems 143

7.4 Chapter Problems

1. Consider the optimization problem

x = arg minx∈RN

||y − Ax||2Λ + λxtBx

where y ∈ RM , A ∈ R

M×N , Λ is a positive-definite M ×M matrix, andB is a positive-definite N ×N matrix, and λ > 0.

a) Show that the cost function is strictly convex.

b) Derive a closed form expression for the solution.

2. For the following problem, consider the MAP cost function f(x; y) ofequation (7.7) where ρ(∆) is a positive convex function of ∆, A hasrank N , and Λ is positive-definite.

a) Prove that there exists an α ∈ R such thatAα =

x ∈ RN : f(x; y) ≤ α

is a compact set (i.e., that f(·; y) has a compact sublevel set as definedin Appendix A).

b) Prove that there is a unique MAP estimate given by

x = arg minx∈RN

f(x; y) .

3. Show that if f : RN → R is a strictly convex function, then x∗ achievesthe global minimum of f(x) if and only if x∗ is a fixed point of thefunction LineSearch(·; d) for all directions d ∈ R

N .

4. Define the function f : R2 → R as

f(x) = |x1 − x0|+ |x1 + x0|2

where x = (x0, x1). Show that in general the ICD algorithm does notconverge to the global minimum of f(x). Why?

5. Let the MAP cost function have the form of (7.7) where the rank ofA is equal to N , the potential functions are strictly convex, and thevalues bs,r ≥ 0. Show that the costs resulting from ICD updates form amonotone decreasing and convergent sequence.

Page 154: Model Based Image Processing (Text)

144 MAP Estimation with Non-Gaussian Priors

6. Consider a cost function of the form

f(x) =1

2||y − Ax||2Λ +

s,r∈Pbs,r(xs − xr)

2 .

Show that f(x+ αd) = c+ θ1α + 12θ2α

2 where

θ1 = −(y − Ax)tΛAd+∑

s,r∈P2bs,r (xs − xr) (ds − dr)

θ2 = dtAtΛAd+∑

s,r∈P2bs,r (ds − dr)

2 .

Page 155: Model Based Image Processing (Text)

Chapter 8

Surrogate Functions and Majorization

As non-quadratic optimization has grown in importance, a very powerful setof methods have emerged known as majorization techniques, which allownon-quadratic optimization problems to be converted into iterative quadraticoptimization. These methods go by a variety of names, but they all share asimilar framework.1 The idea behind majorization techniques is to approxi-mate the true function being minimized by a much simpler function knownas a surrogate or substitute function.

In this chapter, we introduce the concepts of surrogate functions and ma-jorization as powerful tools for efficiently computing the solution to the non-quadratic optimization problems resulting from MAP estimation with non-Gaussian models. We will see that surrogate functions can be very effectivein a broad range of optimization problems because they allow for dramaticsimplification of problems without sacrificing accuracy or convergence speed.Later in Chapter 11, we will also see that surrogate functions play a centralrole in understanding the EM algorithm.

1 Over the years, roughly equivalent methods have been “rediscovered” for differing purposes, and manyof these rediscoveries have resulted in new names for the method. One of the earliest references is themajorant technique of Kantorovich in [40] as a method for insuring the convergence of Newton iterations.Of course, the EM algorithm first introduced in its general form in [3, 2] implicitly uses this method forthe iterative computation of the ML estimate. Ortega and Rheinboldt later discussed the method in thecontext of line search and referred to it as the “majorization principal” [49]. In [38], Huber used the conceptof “global” curvature to minimize 1-D functions resulting from robust estimation procedures. This sameconcept was called “half-quadratic optimization” and applied to the problem of regularization or MAPestimation using non-quadratic priors by Geman in [27]. And, De Pierro introduced the concept to theimage reconstruction community for the purposes of parallel optimization in tomographic reconstruction in[52]. The terms surrogate function [21] and substitute function [71] were later used to describe a techniquefor the parallelization of coordinate descent optimization in tomographic reconstruction.

Page 156: Model Based Image Processing (Text)

146 Surrogate Functions and Majorization

surrogate function

x

f(x)

to be minimizedfunction

x∗ x′x∗

f(x′)

f(x∗)

q(x∗; x′)

q(x; x′)

Figure 8.1: Plots illustrating the relationship between the true function to be min-imized in a line search, f(x), and the surrogate function, q(x; x′). Equation (8.1)requires that the functions be equal at x = x′, and equation (8.2) requires that thesurrogate function upper bounds the true function everywhere.

8.1 Motivation and Intuition

The central concept of majorization is to find a computationally efficientmethod for the minimization of a complicated scalar function f(x), wherex ∈ R

N . Typically, the nature of the function f makes it difficult to directlyoptimize, so our strategy will be to instead minimize a much simpler surrogatefunction denoted by q. Our surrogate function, q, will be designed to fit fabout a point of approximation denoted by x′ in much the same way thata Taylor series approximation is designed to fit a function near a point.

Figure 8.1 illustrates the situation. Both f(x) and q(x; x′) are plotted asa function of x, and both functions are equal at the point of approximation,x = x′. Moreover, we will insist that q(x; x′) both equal f(x) at x = x′

and that, in addition, q(x; x′) be an upper bound to f(x) everywhere else.These two constraints can be expressed mathematically in the following twoequations.

f(x′) = q(x′; x′) (8.1)

f(x) ≤ q(x; x′) (8.2)

Importantly, we will see that these two conditions ensure that minimiza-tion of these surrogate function guarantees minimization of the true function.Again, Figure 8.1 illustrates the situation. Notice that in the figure x∗ is theglobal minimum of f(x), while x∗ is the global minimum of the surrogatefunction q(x; x′). However, since the surrogate function must upper boundthe true function, it must also be the case that f(x∗) < f(x′). So the result of

Page 157: Model Based Image Processing (Text)

8.2 Formal Definition and Properties 147

minimizing the surrogate function must also reduce the true function’s value.

Of course, we have not yet said anything about how we might choose sucha surrogate function, q(x; x′). In fact, the choice of surrogate function willdepend on the specific problem to be solved, but for now we will consider thegeneral case.

Now in order to make the intuition of this figure a bit more formal, imaginethat we have an algorithm for globally minimizing the function q(x; x′) asa function of x from an initial state given by x′ = x(k). Then using theinitial state x(k), we can compute an updated state, x(k+1), using the followingiteration known as the majorization minimization algorithm.

x(k+1) = arg minx∈RN

q(x; x(k))

(8.3)

The following sequence of inequalities then guarantees that the value of f(x)is reduced or at least stays the same with each iteration.

f(x(k+1)) ≤ q(x(k+1); x(k)) ≤ q(x(k); x(k)) = f(x(k)) (8.4)

Notice that the first inequality results from condition (8.2); the second in-equality results from the minimization of equation (8.3); and the third equal-ity results from condition (8.1). Therefore, this proves that the majorizationminimization procedure is guaranteed to produce a monotone decreasing se-quence of values of the true cost function. If the cost function is strictlypositive (or just bounded below), then (8.4) also guarantees that the re-sulting sequence of cost function values, f(x(k)), must converge.2 Again,Figure 8.1 illustrates the intuition behind the inequalities of equation (8.4).Since q(x; x(k)) upper bounds f(x), reducing the value of q(x; x(k)) must guar-antee that f(x) is also reduced.

8.2 Formal Definition and Properties

Now that we understand the intuition behind surrogate functions, we canmake the framework more precise with the introduction of some formal defi-nitions and properties. Now in practice, we can actually relax the conditions

2 A common misconception is to assume that the sequence of actual values, x(k), must also be convergent.However, while this is typically true for practical implementations of the majorization minimization, it isnot guaranteed by the conditions of equations (8.1), (8.2), and (8.3).

Page 158: Model Based Image Processing (Text)

148 Surrogate Functions and Majorization

we gave for the surrogate function and still retain the desired outcome. Inparticular, let c(x′) be any function of the initial state x′. If we define thefunction

Q(x; x′) = q(x; x′) + c(x′) ,

then minimization of the function Q(x; x′) results in the same update of equa-tion (8.3); so it can also be used to substitute for f(x) in the optimization.In particular, if we are given the function Q(x; x′), we can easily compute thefunction q(x; x′) by appropriately shifting the Q function.

q(x; x′) = Q(x; x′)−Q(x′; x′) + f(x′) (8.5)

Notice that with this shift, we ensure the condition of equation (8.1) thatf(x′) = q(x′; x′).

Substituting the expression of equation (8.5) into the condition of equa-tion (8.2) leads to our definition for a valid surrogate function.

Definition 10. Surrogate FunctionLet f(x) be a function on A ⊂ R

N . Then we say that Q(x; x′) is asurrogate function for the minimization of f(x) if for all x, x′ ∈ A thefollowing condition holds.

f(x) ≤ Q(x; x′)−Q(x′; x′) + f(x′) (8.6)

Similarly, we say that Q(x; x′) is a surrogate function for the maximiza-tion of f(x) if for all x, x′ ∈ A

f(x) ≥ Q(x; x′)−Q(x′; x′) + f(x′) (8.7)

Here we will treat the problem of minimization, but surrogate functionsare equally applicable to maximization, and all the equivalent results can beobtained by simply negating the functions being maximized.

Armed with this definition, surrogate function minimization is then per-formed using the very simple majorization minimization algorithm of Fig-ure 8.2. Basically, each iteration of the algorithm minimizes the value of thesurrogate function, and each new surrogate function uses the value of x(k−1)

determined from the previous iteration.

The simple assumptions we have made about the surrogate function willensure some very powerful properties of the associated minimization algo-

Page 159: Model Based Image Processing (Text)

8.2 Formal Definition and Properties 149

rithm. Below we list five such properties. The first property results from asimple rearrangement of the terms of equation (8.6).

Property 8.1. Monotonicity property of majorization - Let Q(x; x′) be a sur-rogate function for minimization of f(x) on A ⊂ R

N . Then for all x, x′ ∈ A,

Q(x; x′) < Q(x′; x′) ⇒ f(x) < f(x′) , (8.8)

and if Q(x; x′) = Q(x′; x′), then f(x) ≤ f(x′).

The next property states that the gradients of the Q and f functions mustbe equal at x = x′. This results from the fact that the functions must betangent; however, it only holds when x′ ∈ int(A).

Property 8.2. Gradient property of surrogate function - Let Q(x; x′) be a sur-rogate function for minimization of f(x) on A ⊂ R

N . Further, assume thatboth Q and f are continuously differentiable functions of x. Then for allx′ ∈ int(A),

∇f(x)|x=x′ = ∇Q(x; x′)|x=x′ . (8.9)

The next property states that if x∗ is a fixed point of the majorizationupdate algorithm, then it must also be a point at which the gradient of thecost function is zero.

Property 8.3. Fixed point property of majorization - Let Q(x; x′) be a surro-gate function for minimization of f(x) on A ⊂ R

N where both Q and f arecontinuously differentiable functions of x. Then for all x∗ ∈ int(A),

Q(x∗; x∗) = minx∈A

Q(x; x∗)

⇒ ∇f(x∗) = 0 . (8.10)

This means that for convex differentiable functions on RN , any fixed point

of the majorization minimization algorithm must correspond to a local mini-mum of the actual function, f . Furthermore, if f is strictly convex, then anysuch local minimum must also be a global minimum.

The fourth property ensures finite additivity of surrogate functions.

Page 160: Model Based Image Processing (Text)

150 Surrogate Functions and Majorization

Property 8.4. Additivity property of surrogate functions - For k = 1, · · · , K,let Qk(x; x

′) be a surrogate function of fk(x) on A ⊂ RN . Furthermore, for

all x, x′ ∈ A define

f(x) ,

K∑

k=1

fk(x)

Q(x; x′) ,

K∑

k=1

Qk(x; x′) .

Then Q(x; x′) is a surrogate function for f(x) on A.This property will be extremely useful because it ensures that we can designsurrogate functions for individual terms of a cost function, and then sumthem all together to form a complete surrogate function for our problem.

Finally, composition of the true and surrogate functions with a third func-tion still results in a valid surrogate function.

Property 8.5. Composition property of surrogate functions - Let Q(x; x′) be asurrogate function for minimization of f(x) on A ⊂ R

N ; and let g : A → A.Then define

f(x) , f(g(x))

Q(x; x′) , Q(g(x); g(x′)) .

Then Q(x; x′) is a surrogate function for f(x).

8.3 Minimizing the MAP Cost Function

Let us next see how majorization techniques can be applied to the MAP costfunction of equation (7.7). For this case, the function to be minimized isgiven by

f(x) =1

2||y − Ax||2Λ +

s,r∈Pbs,rρ(xs − xr) . (8.11)

Since the data term is quadratic, it already can be handled with the opti-mization techniques described in Chapter 5. Therefore, we need to find aquadratic surrogate function that can be used to replace the prior term of

Page 161: Model Based Image Processing (Text)

8.3 Minimizing the MAP Cost Function 151

Majorization Minimization Algorithm:

Initialize x′

For k = 1 to K x′ ← argmin

x∈AQ(x; x′)

x∗ = x′

Figure 8.2: This figure provides a pseudocode specification of the majorization min-imization algorithm. In each iteration, the true function, f(x), is approximated bya surrogate function, Q(x; x′), in order to compute the minimum. The properties ofthe surrogate function ensure that this produces a monontone decreasing sequence ofvalues f(x′).

f(x). We can do this by first finding a surrogate function for the poten-tial function, ρ(∆), and then applying the results of Properties 8.4 and 8.5.More specifically, if we can determine a surrogate potential function, ρ(∆;∆′),which is a quadratic function of ∆, then we may use ρ(∆;∆′) to construct asurrogate MAP cost function with the following form

Q(x; x′) =1

2||y − Ax||2Λ +

s,r∈Pbs,rρ(xs − xr; x

′s − x′r) . (8.12)

Once this is done, Q(x; x′) is then a quadratic function of x, and the opti-mization problem has the same form as considered in Chapter 5. Repeatedoptimization of the Q function, as specified by the majorization minimizationalgorithm of Figure 8.2, will then also minimize the true MAP cost functionf(x).

So our objective is to find a surrogate function, ρ(∆;∆′), for the potentialfunction ρ(∆). There are a number of strategies for doing this, and the bestchoice tends to depend on the specific structure of the potential functionbeing minimized.

We will first use the maximum curvature method to construct a surro-gate function. To do this, assume a surrogate function of the form,

ρ(∆;∆′) = a1∆+a22(∆−∆′)

2.

By simply matching the gradients of ρ(∆) and ρ(∆;∆′) at ∆ = ∆′ as de-scribed in Property 8.2, we can find the value of the coefficient a1.

a1 = ρ′(∆′)

Page 162: Model Based Image Processing (Text)

152 Surrogate Functions and Majorization

Now in order to ensure that the surrogate function is an upper bound tothe true function, we will select the value of a2 to be the maximum of thepotential function’s second derivative.

a2 = cmax , max∆∈R

ρ′′(∆) (8.13)

Notice that for a given potential function, cmax does not change; so only a1must be recomputed each time ∆′ changes. Putting this all together, we getthe following maximum curvature surrogate function for ρ(∆).

ρ(∆;∆′) = ρ′(∆′)∆ +cmax

2(∆−∆′)

2(8.14)

Plugging this surrogate function into the expression of equation (8.12) re-sults in a complete expression for the MAP surrogate cost function using themaximum curvature method.

Q(x; x′) =1

2||y − Ax||2Λ +

s,r∈Pbs,r ρ

′(x′s − x′r) (xs − xr) (8.15)

+∑

s,r∈P

bs,rcmax

2(xs − x′s − (xr − x′r))

2

A disadvantage of the maximum curvature method is that it tends to be tooconservative in the choice of the curvature a2. This is particularly true if thesecond derivative of the potential function is large near zero. In fact, if thesecond derivative is infinite, then there is no maximum, and the method cannot be used.

The symmetric bound method can be used in place of the maximumcurvature method. The advantage of this method is that it usually resultsin a much less conservative upper bound; so it tends to yield optimizationalgorithms that converge much faster than those of the maximum curvaturemethod. The symmetric bound method works for all the potential functionsin Section 6.3 and is illustrated in Figure 8.3. In this strategy, each potentialfunction from equation (7.6) is upper bounded by a surrogate function thatis a symmetric and quadratic function of ∆. Using this assumption, thesurrogate function has the form

ρ(∆;∆′) =a22∆2 ,

Page 163: Model Based Image Processing (Text)

8.3 Minimizing the MAP Cost Function 153

surrogate function

to be minimized

function

∆′

−∆′

ρ(∆)

ρ(∆;∆′) + const

Figure 8.3: Figure showing the intuition behind the symmetric bound surrogate func-tion of equation (8.17). For some convex functions, the value of the second derivativecan be chosen so that the function touches and is tangent to the potential functionat two symmetric points about 0. This tends to produce a much tighter surrogatefunction.

where a2 is a function of ∆′.

In order to determine a2, we again match the gradients of ρ(∆) andρ(∆;∆′) at ∆ = ∆′ to yield

a2 =ρ′(∆′)

∆′, (8.16)

which results in the following symmetric bound surrogate function,

ρ(∆;∆′) =

ρ′(∆′)2∆′ ∆

2 if ∆′ 6= 0

ρ′′(0)2 ∆2 if ∆′ = 0

, (8.17)

where we use the limiting value of a2 = ρ′′(0) when ∆′ = 0.

Of course, the question remains as to whether this function of equa-tion (8.17) will achieve the defining constraint of equation (8.6). It can beshown that in fact the constraint is met for any potential function with theproperty that its second derivative decreases as |∆| increases. This is alsoequivalent to the condition that the influence function ρ′(∆) is concave for∆ > 0; or equivalently, that the influence function is convex for ∆ < 0. Inpractice, this is a common property for practical potential functions since

Page 164: Model Based Image Processing (Text)

154 Surrogate Functions and Majorization

Name ρ(∆)ρ′(∆′)

2∆′

ρ′′(0)

2

Quadratic∆2

2σ2x

1

2σ2x

1

2σ2x

TotalVariation

|∆|σx

1

2σx|∆′| ∞

Huber

∆2

2σ2x

for |∆|<Tσx

T∣

∆σx

∣− T 2

2 for |∆|≥Tσx

clip∆′, [−Tσx, Tσx]2σ2

x∆′

1

2σ2x

log cosh T 2 log cosh

(

Tσx

)

T tanh(

∆′

Tσx

)

2σx∆′

1

2σ2x

GGMRF|∆|ppσp

x

|∆′|p−2

2σpx

∞ for 1 ≤ p < 2

QGGMRF(p ≤ q)

|∆|ppσp

x

∆Tσx

q−p

1 +∣

∆Tσx

q−p

|∆′|p−2

2σpx

∆′

Tσx

q−p(

qp +

∆′

Tσx

q−p)

(

1 +∣

∆′

Tσx

q−p)2

1

pσ2xT

2−pfor q = 2

Table 8.1: Analytical expressions for the coefficients used in the symmetric bound ofequation (8.17).

it means that the influence of pixels will decrease as the difference betweenpixels increases.

Table 8.1 lists out the analytical expressions for the terms of equation (8.17)for each of the potential functions we have discussed. Notice that some ofthe expressions for ρ′′(0)/2 are unbounded. For example, this is the case forthe total variation potential function because its second derivative becomesunbounded at zero. This represents a real practical problem when using sur-rogate functions. In fact, a major advantage of the Huber and QGGMRFpotentials is that they have bounded second derivatives at zero; so both thesepotential functions are compatible with surrogate optimization methods. InChapter 9 we will address this problem by introducing new algorithms thatcan be used when computing the MAP estimate with potential functions suchas the total variation prior.

Substituting the symmetric bound surrogate function of (8.17) into equa-

Page 165: Model Based Image Processing (Text)

8.3 Minimizing the MAP Cost Function 155

tion (8.12) results in the following MAP surrogate cost function,

Q(x; x′) =1

2||y − Ax||2Λ +

s,r∈P

bs,rρ′(x′s − x′r)

2(x′s − x′r)(xs − xr)

2 , (8.18)

where for simplicity we assume that x′s−x′r 6= 0. Below is an example of howthis method can be applied for a particular choice of potential function.

Name Surrogate Function Coefficient bs,r of Equation (8.19)

General bs,r ← bs,rρ′(x′s − x′r)

2(x′s − x′r)

Quadratic bs,r ← bs,r1

2σ2x

TotalVariation

bs,r ← bs,r1

2σx|x′s − x′r|

Huber bs,r ← bs,rclipx′s − x′r, [−Tσx, Tσx]

2σ2x(x

′s − x′r)

log cosh bs,r ← bs,r

T tanh(

x′

s−x′

r

Tσx

)

2σx(x′s − x′r)

GGMRF bs,r ← bs,r|x′s − x′r|p−2

2σpx

QGGMRF bs,r ← bs,r|x′s − x′r|p−2

2σpx

x′

s−x′

r

Tσx

q−p(

qp +

x′

s−x′

r

Tσx

q−p)

(

1 +∣

x′

s−x′

r

Tσx

q−p)2

Table 8.2: Analytical expressions for the coefficient bs,r required for computing thesurrogate function using the symmetric bound method. Each expression correspondsto a potential function given in Table 6.1 of Section 6.4.

An alternative way to think about the surrogate function approach is thatwith each iteration, we recompute the local coefficients, bs,r. Using this pointof view, we can express the surrogate MAP cost function as

bs,r ← bs,rρ′(x′s − x′r)

2(x′s − x′r)(8.19)

Q(x; x′) =1

2||y − Ax||2Λ +

s,r∈Pbs,r (xs − xr)

2 , (8.20)

Page 166: Model Based Image Processing (Text)

156 Surrogate Functions and Majorization

where the coefficients, bs,r, are the modified coefficients that are updated witheach iteration of an optimization algorithm.

So in practice, in order to implement a particular potential function onesimply computes the values of bs,r corresponding to their desired choice of po-tential function. Table 8.2 lists out the specific formulas for the coefficients,bs,r, for each of the potential functions we have considered in Table 6.1. Whilethe formulas might seem a bit messy, the approach is straightforward. Onesimply calculates the value of bs,r corresponding to the desired potential func-tion, and then minimizes the quadratic cost function of equation (8.20) withrespect to x.

Example 8.1. In this example, we find the symmetric bound surrogate func-tion for the Huber potential listed in Table 6.1 of Section 6.4. In this case,the potential function is given by

ρ(∆) =

∆2

2σ2x

for |∆| < Tσx

T∣

∆σx

∣− T 2

2 for |∆| ≥ Tσx,

and its associated influence function is given by

ρ′(∆) =1

σ2x

clip∆, [−Tσx, Tσx] ,

where the function clipx, [a, b] clips the value x to the interval [a, b]. Forthe symmetric bound, the surrogate function of equation (8.17) is given by

ρ(∆;∆′) =clip∆′, [−Tσx, Tσx]

2σ2x∆′ ∆2 . (8.21)

Notice that the result of equation (8.21) corresponds to the entry labeled“Huber” in Table 8.2. So in practice, we could have skipped this analysis,and referred directly to the Table to find the update for the bs,r terms givenby

bs,r ←

bs,rclipx′s − x′r, [−Tσx, Tσx]

2σ2x(x′s − x′r)

for x′s 6= x′r

bs,r2σ2

x

for x′s = x′r

,

Page 167: Model Based Image Processing (Text)

8.4 Application to Line Search 157

where we explicitly add the case when x′s = x′r. From this, the symmetricbound MAP surrogate cost function is given by

Q(x; x′) =1

2||y − Ax||2Λ +

s,r∈Pbs,r (xs − xr)

2 . (8.22)

The MAP estimate can then be computed though repeated minimization of(8.22). Since the function is now a quadratic function of x, a wide variety ofoptimization algorithms can be used for this purpose.

8.4 Application to Line Search

In order to better understand how surrogate functions can be used, let usnext consider its application to the important problem of line-search opti-mization discussed in Section 7.2. In this case, our objective is to solve the1-D minimization problem

α∗ = arg minα∈[a,b]

f(x+ αd) ,

where x ∈ RN is the current value of the solution, d ∈ R

N is the updatedirection, α is the unknown update step size, and [a, b] is a search intervalthat includes 0.

Using a surrogate function in place of f(x), we compute the modified linesearch

α∗ = arg minα∈[a,b]

Q(x+ αd; x) ,

where we assume that α ∈ [a, b]. Now since the surrogate MAP cost functionof equation (8.22) is a quadratic function of x, we can use the same trick andexpress the line search function as a quadratic function of α,

Q(x+ αd; x) = c+ θ1α +1

2θ2α

2 ,

where it can be shown that (See problem 6)

θ1 = −(y − Ax)tΛAd+∑

s,r∈P2bs,r (xs − xr) (ds − dr) (8.23)

θ2 = dtAtΛAd+∑

s,r∈P2bs,r (ds − dr)

2 . (8.24)

Page 168: Model Based Image Processing (Text)

158 Surrogate Functions and Majorization

General MAP Optimization using Majorization of Prior:

Initialize xFor K iterations d, a, b ← SelectSearchDirectionAndInterval(x)

bs,r ←bs,rρ

′(xs − xr)

2(xs − xr)

θ1 ← −(y − Ax)tΛAd+∑

s,r∈P

2bs,r (xs − xr) (ds − dr)

θ2 ← dtAtΛAd+∑

s,r∈P

2bs,r (ds − dr)2

α∗ ← clip

−θ1θ2

, [a, b]

x ← x+ dα∗

Figure 8.4: Pseudocode for the implementation of a general MAP optimization pro-cedure that uses majorization of the prior term. Each line search is approximatelysolved by replacing the true prior term with a surrogate function.

In this case, the line search solution has the very simple form of

α∗ = clip

−θ1θ2

, [a, b]

.

Figure 8.4 provides a pseudocode specification of a generic optimizationalgorithm which uses this majorization approach in the line search step. Thesearch direction may vary based on the specific choice of optimization al-gorithm, but the computation of the line search always follows the sameprocedure. Notice that the resulting value of α∗ guarantees that

f(x+ α∗d)− f(x) ≤ Q(x+ α∗d; x)−Q(x; x) ≤ 0 ,

so we know that the true cost function decreases with each iteration of thisalgorithm. The advantage of this modified line search is that the 1-D opti-mization can be computed very efficiently in one step. This is in contrastto the many iterations that may be required of the half-interval search ofSection 7.2.

Example 8.2. In this example, we derive the explicit expressions for ICDupdates using a symmetric surrogate function. For the ICD algorithm, the

Page 169: Model Based Image Processing (Text)

8.4 Application to Line Search 159

ICD Algorithm using Majorization of Prior:

Initialize e← y − AxFor K iterations

For each pixel s ∈ S

bs,r ←bs,rρ

′(xs − xr)

2(xs − xr)

θ1 ← −etΛA∗,s +∑

r∈∂s

2bs,r (xs − xr)

θ2 ← At∗,sΛA∗,s +

r∈∂s

2bs,r

α∗ ← clip

−θ1θ2

, [−xs,∞)

xs ← xs + α∗

e ← e− A∗,sα∗

Figure 8.5: Pseudocode for fast implementation of the ICD algorithm with majoriza-tion of the prior term. The speedup depends on the use of a state variable to storethe error, e = y−Ax. Each line search is approximately solved by replacing the trueprior term with a surrogate function.

update direction is given by d = εs where εs is a vector that is 1 for elements, and 0 otherwise. So using equations (8.23) and (8.24), we can derivea simplified expression for the first and second derivatives of the ICD linesearch.

θ1 = −etΛA∗,s +∑

r∈∂s2bs,r (xs − xr) (8.25)

θ2 = At∗,sΛA∗,s +

r∈∂s2bs,r . (8.26)

where e = y − Ax is the error in the measurement domain. If A is a sparsematrix, then keeping this state vector, e, can dramatically reduce the com-putation required for an ICD update.

Again, Figure 8.5 provides a pseudocode specification of this completealgorithm. Notice that, while the surrogate function approach does not com-pute the exact local minimum of the line search problem, it does guaranteemonotone convergence, and in practice it results in a fast and computation-

Page 170: Model Based Image Processing (Text)

160 Surrogate Functions and Majorization

ally efficient algorithm.

Page 171: Model Based Image Processing (Text)

8.5 Chapter Problems 161

8.5 Chapter Problems

1. Prove the properties corresponding to equations (8.4), (8.9), and (8.10).

2. Prove that if the potential function ρ(∆) has the property that its as-sociated influence function ρ′(∆) is concave for ∆ > 0 (or equivalently,convex for ∆ < 0), then the symmetric bound surrogate function ofequation (8.17) produces an upper bound to the true function.

3. Provide a counter example to the proof of problem 2 when the influencefunction is not concave for ∆ > 0. (Hint: Try the function ρ(∆) = |∆|pfor p > 2.)

4. Consider the functionf(x) = |x− xr|1.1 ,

for x ∈ R.

a) Sketch a plot of f(x) when xr = 1.

b) Sketch a good surrogate function, f(x; x′), for xr = 1 and x′ = 2.

c) Determine a general expression for the surrogate function f(x; x′) thatworks for any value of xr and x′.

d) Assuming the objective is to minimize the expression

f(x) =∑

r∈∂s|x− xr|1.1 ,

for x ∈ R, specify an iterative algorithm in terms of the surrogate func-tion f(x; x′) that will converge to the global minimum of the function.

5. Let ρ(x) for x ∈ R be the Huber function for T = 1. The objective ofthis problem is to determine surrogate functions, Q(x; x′), for ρ(x).

a) Use the maximum curvature method to determine Q(x; x′).

b) From Q(x; x′), determine the function q(x; x′), so that q(x; x) = f(x).

c) Plot the functions ρ(x) and q(x; x′) for x′ = 4 and indicate the locationof the minimum

x′′ = argminx∈R

q(x; 4)

d) Use the symmetric bound method to determine Q(x; x′).

Page 172: Model Based Image Processing (Text)

162 Surrogate Functions and Majorization

e) From Q(x; x′), determine the function q(x; x′), so that q(x; x) = f(x).

f) Plot the functions ρ(x) and q(x; x′) for x′ = 4 and indicate the locationof the minimum

x′′ = argminx∈R

q(x; 4)

g) What are the advantages and disadvantages of maximum curvatureand symmetric methods?

Page 173: Model Based Image Processing (Text)

Chapter 9

Constrained Optimization

In recent years, there has been a growing awareness that constrained opti-mization can be of great importance not only as a way in which to enforcephysical constraints, but also has a clever strategy for making large and dif-ficult optimization problems numerically more tractable. This is particularlyinteresting since it runs against the natural intuition that unconstrained op-timization is easier than constrained optimization.

The goal of this chapter is to introduce the essential machinery of con-strained optimization and then illustrate the power of these methods withsome canonical examples. The chapter starts by first motivating the prob-lem, and then covering the basic theory of constrained optimization includingthe theory and methods of the augmented Lagrangian. We show how the aug-mented Lagrangian provides a practical framework for solving large numericaloptimization problems with constraints. With these tools in hand, we thenintroduce variable splitting, proximal mappings, and the ADMM algorithmas methods for decomposing large and difficult MAP optimization problemsinto smaller more manageable ones. Finally, we illustrate the power of theseapproaches by formulating solutions to some very important optimizationproblems including total variation regularization and MAP optimization withpositivity constraints.

9.1 Motivation and Intuition

The methods of constrained optimization have grown to be very important inmodel-based imaging. For example, positivity constraints are very common in

Page 174: Model Based Image Processing (Text)

164 Constrained Optimization

imaging problems since the unknown, X, often represents quantities relatedto energy or absorption, which must be positive for physical reasons. In thiscase, the need for constrained optimization is obvious since the MAP estimatemust be computed using the convex constraint that X ∈ R

+N .

However, in recent years, it has also become clear that constrained opti-mization techniques can be extremely useful for solving large unconstrainedMAP optimization problems. In order to illustrate this counter-intuitive fact,we start with a familiar problem which requires the unconstrained optimiza-tion of two separate terms.

x = arg minx∈RN

f(x) + g(x) (9.1)

In fact, this problem has the form of a typical MAP optimization problemwhere f(x) is the negative log likelihood and g(x) is the negative log priorprobability.

First notice that the unconstrained optimization problem of equation (9.1)can also be used to enforce positivity constraints by setting g(x) = ∞ forx 6∈ R

+N . So for example, if we choose

g(x) =

0 if x ∈ R+N

∞ if x 6∈ R+N

Then in this case, we have that

argminxf(x) + g(x) = arg min

x∈R+Nf(x) . (9.2)

Intuitively, adding g enforces the positivity by making the cost functioninfinite when x moves outside the constraint. We say that g is an ex-tended function because it takes values on R∪∞. Perhaps surprisingly,g : RN → R ∪ ∞ is also a convex function if we apply the standard def-inition of convexity using the very reasonable convention that ∞ + a = ∞.Moreover, g is also a proper and closed convex function using the definitionsgiven in Appendix A.

Now we will do something very counter-intuitive. We will take a perfectlygood unconstrained optimization problem with a single independent variable,x, and we will “split” the variable into two variables, x and v, with theconstraint that x = v. So then the new, but fully equivalent, problem is

Page 175: Model Based Image Processing (Text)

9.1 Motivation and Intuition 165

given by

(x, v) = argmin(x,v)

x=v

f(x) + g(v) . (9.3)

Well, that certainly seems like a silly thing to do. Of course, given the con-straint it must be that x = v and therefore that the solution to equations (9.1)and (9.3) must be the same. But why would anyone want to do such at thing?

Well rather than answering that question now, we will continue to forgeahead and solve this constrained optimization problem so we can see whereit leads us. In order to enforce the constraint, we will add an additional termto the cost function that penalizes large differences between x and v. Thisthen results in the unconstrained optimization problem given by

(x, v) = argmin(x,v)

f(x) + g(v) +a

2||x− v||2

, (9.4)

where a is a constant that controls the gain of the penalty term.

Now as the value of a is increased, the constraint of x = v is more aggres-sively enforce. So by making a very large, we should be able to force x ≈ v.However, no matter how large we make a, it will likely never be the casethat x = v; so the solution to equation (9.4) will not be exactly the same asthe original problem of equations (9.1). In order to fix this problem, we willneed to augment the problem with an additional term that can “push” thesolution towards a result that exactly meets the constraint x = v. This canbe done by using the following modified unconstrained optimization problem

(x, v) = argmin(x,v)

f(x) + g(v) +a

2||x− v + u||2

, (9.5)

where u must be chosen to achieve the desired constraint that x = v.

In fact, in Section 9.3, we will see that the expression being minimized inequation (9.5) is known as the augmented Lagrangian for our constrainedoptimization problem and the term u serves a role equivalent to that of aLagrange multiplier. The beauty of this approach is that the correct valueof u can be determined using the following simple augmented Lagrangianalgorithm.

Page 176: Model Based Image Processing (Text)

166 Constrained Optimization

Split-Variable Augmented Lagrangian AlgorithmInitialize u← 0 and v ← 0For K iterations

(x, v) ← argmin(x,v)

f(x) + g(v) +a

2||x− v + u||2

u ← u+ (x− v)

So with each iteration, the value of u is increased (or decreased) by thedifference δ = x − v. Intuitively, if δ is positive, then u ← u + δ increasesthe value of u, which then “pushes” δ down until of x = v. Alternatively, ifδ is negative, then u← u + δ decreases the value of u, which then “pushes”δ up until of x = v. Either way, this iterative process drives u to a valuewhich causes the constraint of x = v to be met. Later in Section 9.2, we willintroduce the basic machinery of convex optimization including the dualityprinciple, and in Section 9.3 we will use this machinery to prove that thisaugmented Lagrangian algorithm converges to the correct value of u.

With the problem in this form, any engineer worth their salt should havea strong desire to approximately perform the optimization of (x, v) in twosteps using alternating minimization of x and v. Of course, it won’t producethe same answer, but it should be close, and it seems like it would be mucheasier to do. This alternating optimization approach is shown below andknown as the alternating directions method of multipliers or ADMMalgorithm.

Split-Variable ADMM AlgorithmInitialize u← 0 and v ← 0For K iterations

x ← argminx

f(x) +a

2||x− v + u||2

v ← argminv

g(v) +a

2||x− v + u||2

u ← u+ (x− v)

As it turns out, the ADMM algorithm is also convergent for convex opti-

Page 177: Model Based Image Processing (Text)

9.1 Motivation and Intuition 167

mization problems as we will discuss in Sections 9.5.

Now we return to the original question of, why would we choose to solvethe problem of equation (9.1) using this split-variable augmented Lagrangianalgorithm rather than direct optimization? The reason is that for manyimportant optimization problems the two functions, f(x) and g(x), are sodifferent that a single optimization approach is not appropriate for both.Since the split-variable ADMM algorithm allows the two expressions to beminimized separately, each term may be minimized with a different algorithmthat is best suited to its structure. Intuitively, the ADMM approach allowsthe two variables x and v to move along separate paths and then convergetogether to a single coherent solution.

Perhaps this can be best illustrated by again considering the problem ofoptimization with a positivity constraint as in equation (9.2). In this case,the optimization over v can be computed in closed form and is given by

v = argminv

g(v) +a

2||x− v + u||2

= arg minv∈R+N

a

2||x+ u− v||2

= clip

x+ u,R+N

,

where we define the function clipx,A that projects or “clips” any vector xonto the convex set A. (See Appendix A) For the special case of non-negativevectors, we have that A = R

+N and for each component

[

clip

x,R+N]

i= clipxi, [0,∞) ,

so each component is clipped to be non-negative.

Applying the split-variable ADMM algorithm to this problem, we thenget the following algorithm for enforcing positivity in the minimization ofany convex function f(x).

Page 178: Model Based Image Processing (Text)

168 Constrained Optimization

Split-Variable ADMM for Positivity ConstraintInitialize u← 0 and v ← 0For K iterations

x ← argminx

f(x) +a

2||x− (v − u)||2

v ← clip

x+ u,R+N

u ← u+ (x− v)

So this split-variable ADMM algorithm provides a simple and effectivemethod for enforcing positivity in any convex optimization problem. As apractical matter, it can also be used in non-convex optimization problems,but its theoretical convergence properties to a global minimum are no longerguaranteed in this case.

9.2 The Lagrangian and Dual Function

While the examples of the previous section provided intuitive motivation, thediscussion was primarily based on “hand waving” arguments. The objectiveof this section is to provide a rigorous development of the theoretical ma-chinery for constrained optimization, so that the discussion can be put ona much more solid footing. In particular, we will introduce the concept ofconstrained optimization with Lagrange multipliers along with the conceptof a dual function. The dual function will serve a crucial role in selecting thecorrect value of the Lagrange multiplier that causes the desired constraint tobe met.

We will develop this basic theory of constrained optimization by consider-ing problems with the general form

x∗ = arg minx∈ΩCx=b

f(x) , (9.6)

where b ∈ RK , C ∈ R

K×N , Ω ⊂ RN is assumed to be a closed convex set with

nonempty interior, and f(x) takes values in R. If we would like to enforcepositivity in the result, we can set Ω = R

+N , which is a particular exampleof a closed convex set with a non-empty interior.

Page 179: Model Based Image Processing (Text)

9.2 The Lagrangian and Dual Function 169

In this case, equation (9.6) represents a convex optimization problem. Ofcourse, this is not the most general form of the constrained optimizationproblem. For example, the constraint could be non-linear with the formC(x) = b, or the function f(x) might be non-convex. Nonetheless, the prob-lem of equation (9.6) covers a wide range of important practical problemsincluding linear programing.

The form of equation (9.6) implicitly assumes that the global minimumexists and is unique. However, this may not be the case, even when f(x)is a convex function. In order to handle this more general case, we mayreformulate the constrained optimization problem as

p∗ = infx∈ΩCx=b

f(x) , (9.7)

where p∗ ∈ [−∞,∞) is the infimum of the function subject to the con-straints.1 Then if the function takes on its minimum, we have that p∗ = f(x∗).

The classic approach to constrained optimization is the method of La-grange multipliers. The Lagrange method converts a constrained problem toan unconstrained one by adding a linear term that drives the solution to theconstraint. To do this, we first define the Lagrangian for the constrainedoptimization problem as

L(x;λ) = f(x) + λt(Cx− b) , (9.8)

where λ ∈ RK is the so-called Lagrange multiplier; we then compute the

solution to the unconstrained optimization problem as

x(λ) = argminx∈Ω

L(x;λ) , (9.9)

where x(λ) denotes a solution for a specific value of λ. Of course, the difficultywith this approach is the selection of the correct value for λ. On the simplestlevel, the value of λ must be chosen so that the constraint is met.

Cx(λ) = b (9.10)

However, this is typically not a practical approach since it is often difficultto analytically or numerically solve this equation.

1 The operations a = infx∈Ω f(x) and b = supx∈Ω f(x) refer to the greatest lower bound and least upperbound, respectively. The infimum and supremum always exist for any real-valued function f(x) and any setΩ, but the results, a and b, take vales in the extended real line [−∞,∞].

Page 180: Model Based Image Processing (Text)

170 Constrained Optimization

An alternative and very powerful view of the Lagrangian problem comesby considering its dual. We define the dual function as

g(λ) = infx∈Ω

L(x;λ) , (9.11)

where g : RK → [−∞,∞). Notice that for some values of λ, it may be thatg(λ) = −∞. However, this won’t cause any problems. In this context, werefer to the original function, f(x), as the primal function and g(λ) as itsdual.

As it turns out, the dual function has many interesting and useful prop-erties. First notice, that for each distinct value of x, the function

L(x;λ) = f(x) + λt(Cx− b) ,

is an affine function of λ, which is of course a concave function of λ. Thereforeby applying Property A.4, we know that g(λ) must be concave because it isformed from the minimum of a set of concave functions. Notice that thisconcavity property always holds even when the primal function, f(x), is notconvex.

Property 9.1. Concavity of the dual function - The dual function g(λ) fromequation (9.11) is concave on λ ∈ R

K .

The dual function is very important because it is a lower bound that canbe maximized to find the best value for the Lagrange multiplier λ. In orderto make this concept more formal, define d∗ to be the supremum of the dualfunction,

d∗ , supλ∈RK

g(λ) . (9.12)

Furthermore, let λ∗ denote a value of the Lagrange multiplier that achievesthat maximum. So when λ∗ exists, then d∗ = g(λ∗).

Using these definitions, we next define the duality gap as p∗ − d∗, i.e.,the difference between the minimum of the primal cost function and themaximum of its dual. We first prove that this duality gap must be positive.

Property 9.2. Non-negative duality gap - The duality gap is non-negative sothat

p∗ ≥ d∗ .

Page 181: Model Based Image Processing (Text)

9.2 The Lagrangian and Dual Function 171

Proof. The duality gap is a direct result of the very general max-min in-equality. (See problem 3) Applying this inequality to the Lagrangian func-tion, we get that

infx∈Ω

supλ∈RK

L(x;λ) ≥ supλ∈RK

infx∈Ω

L(x;λ) . (9.13)

Now in order to better understand the left-hand side of the equation, firstnotice that

supλ∈RK

L(x;λ) =

f(x) if Cx = b∞ if Cx 6= b

.

So therefore, it must be that

infx∈Ω

supλ∈RK

L(x;λ) = p∗ .

Similarly, on the right-hand side of the equation, we have that

infx∈Ω

L(x;λ) = g(λ) .

So substituting these two results into equation (9.13), we have that

p∗ ≥ supλ∈RK

g(λ) = d∗ ,

and the proof is complete.

9.2.1 Strong Duality

In typical cases the dual function is not just a lower bound to the solution ofthe primal function. In fact, the solutions to the primal and dual functionsoccur at that same place and take on the same value. This makes the twoproblems essentially equivalent. We can make this idea more precise by firstdefining the idea of strong duality. Strong duality holds when p∗ = d∗, sothat the minimum of the primal function is equal to the maximum of its dual.In the remainder of this section we will see that when strong duality holds,the dual and primal problems can be used together to solve the constrainedoptimization. This is good news because we will also see that strong dualityholds for most practical problems.

The next property states the key result that when strong duality holds,then the unconstrained optimization problem of equation (9.9) can be used

Page 182: Model Based Image Processing (Text)

172 Constrained Optimization

to solve the constrained optimization of equation (9.6). However, to do this,we must set the Lagrange multiplier to λ∗, the solution to the dual problemof equation (9.12).

Property 9.3. Optimal Lagrange multiplier - Consider a constrained optimiza-tion problem with the form of equation (9.7) such that:

• Strong duality holds with p∗ = d∗;

• x∗ ∈ Ω achieves the minimum to the constrained optimization problem;

• λ∗ ∈ RK achieves the maximum of the dual function.

Then x∗ is also a solution to the unconstrained optimization problem

L(x∗;λ∗) = infx∈Ω

L(x;λ∗) .

Furthermore, if f(x) is strictly convex, then x∗ is unique.

Proof. Now if x∗ is the solution to the constrained optimization problem ofequation (9.6), then we know that Cx∗ − b = 0. Therefore, when strongduality holds, we must have that

L(x∗;λ∗) = f(x∗) + λ∗(Cx∗ − b)

= f(x∗)

= p∗ = d∗

= g(λ∗)

= infx∈Ω

L(x;λ∗) .

So therefore we know that, when strong duality holds, then a solution to theconstrained minimization problem, x∗, must also be a solution to the uncon-strained optimization problem when λ∗ is used as the Lagrange multiplier.Moreover, if f(x) is strictly convex, then this solution to the unconstrainedoptimization problem must be unique.

9.2.2 Technical Conditions for Strong Duality

Property 9.3 tells us that if strong duality holds, then we can solve the con-strained optimization problem of equation (9.6) by first computing λ∗, as

Page 183: Model Based Image Processing (Text)

9.2 The Lagrangian and Dual Function 173

the solution to the dual problem, and then using λ∗ as the correct Lagrangemultiplier in unconstrained optimization of equation (9.9).

As it turns out, strong duality holds in most practical situations. However,finding conditions that ensure this can be a challenge. We can develop moreintuition for this problem by first considering the simplified case when boththe primal function and its solution are continuously differentiable. In thishighly regular case, the gradient of the dual function is given by [44]

∇g(λ∗) = Cx(λ∗)− b ,

where the function x(λ) is defined in equation (9.9). (See problem 4) Usingthis result and the fact that g(λ) is concave, we know that λ∗ is the globalmaximum of g(λ) if and only if ∇g(λ∗) = Cx(λ∗)− b = 0. From this we canthen show that d∗ ≥ p∗ through the following set of inequalities.

d∗ = g(λ∗)

= minx∈Ω

f(x) + [λ∗]t(Cx− b)

= f(x(λ∗)) + [λ∗]t(Cx(λ∗)− b)

= f(x(λ∗))

≥ f(x∗) = p∗

Putting this together with Property 9.2, we must have that d∗ = p∗ andstrong duality holds. So we see that strong duality holds when the functionf(x) is sufficiently regular on R

N .

Fortunately, there exists a relatively general set of technical conditionsknown as Slater’s conditions that can be used to ensure strong dualityfor just about any reasonable convex optimization problem [61, 15]. Thefollowing definition states a simplified form of Slater’s conditions for ourparticular problem.

Definition 11. Slater’s ConditionsThe optimization problem with the form of equation (9.7) is said tomeet Slater’s conditions if there exists an x′ in the interior of Ω suchthat Cx′ = b.

Stated differently, Slater’s conditions require that there is at least onestrictly feasible solution to the optimization problem. We say that thesolution is strictly feasible because it falls in the interior of Ω and it meets

Page 184: Model Based Image Processing (Text)

174 Constrained Optimization

the constraint of Cx′ = b. For most practical problems, it is easy to finda feasible solution that falls within the interior of the domain. So typically,this is a technical constraint that can be easily verified.

The following theorem proved by Slater provides a powerful tool for en-suring that strong duality holds in practical situations.

Property 9.4. Slater’s Theorem - Consider a constrained optimization problemwith the form of equation (9.7) such that Slater’s conditions hold and f(x)is a convex function on a closed convex set Ω. Then

• Strong duality holds with p∗ = d∗;

• There exists λ∗ ∈ RK such that d∗ = g(λ∗).

Proof. See for example [15] page 234.

Intuitively, Slater’s Theorem states that if a convex optimization problemmeets Slater’s conditions, then it has strong duality, and by Property 9.3 thisensures that λ∗ is the correct Lagrange multiplier to enforce the constraint.

From a theoretical perspective, Property 9.4 tells us how to solve any con-vex optimization problems when Slater’s conditions hold. First, we determineλ∗ by solving the dual problem,

λ∗ = arg maxλ∈RK

g(λ) . (9.14)

Then we use the resulting value of λ∗ to solve the unconstrained optimizationproblem

x∗ = argminx∈Ω

f(x) + [λ∗]t (Cx− b)

, (9.15)

where x∗ is then the solution to the constrained optimization problem ofequation (9.6). However, the difficulty with this approach is that the dualfunction, g(λ), typically does not have closed form. So it is still not clearhow to determine λ∗. The following section provides a practical solution tothis problem.

Page 185: Model Based Image Processing (Text)

9.3 The Augmented Lagrangian 175

9.3 The Augmented Lagrangian

Lagrange multipliers provide a beautiful theory for solving constrained opti-mization problems. However, at this point, it is unclear how to practicallycompute the value of λ∗ that will properly enforce the constraint. In someanalytical problems, it is possible to explicitly solve the constraint of equa-tion (9.10) for the desired value of λ∗. However, for large numerical problems,this is not possible. Another approach is to determine λ∗ by maximizing thedual function of g(λ). However, the function g(λ) usually does not have anexplicit form that can be easily maximized. So at this point, the framework ofLagrange multipliers and primal-dual functions seems beautiful but perhapssomewhat useless.

Fortunately, the augmented Lagrangian method [37, 53] solves thisproblem by providing a numerically stable approach for computing λ∗ bysimultaneously solving both the primal and dual problems. More specifically,we will see that the augmented Lagrangian approach results in an explicatedalgorithm that is easily implemented and that is theoretically guaranteed toconverge to the optimal Lagrange multiplier λ∗.

The augmented Lagrangian approach works by augmenting the basic op-timization problem with an additional quadratic term that helps drive thesolution towards the constraint. However, an unexpected result of adding thisadditional term is that we can then derive a recursion for λ that convergesto the desired value of λ∗.

Now, in order to derive the methods and theory of augmented Lagrangianoptimization, we will first define the following canonical convex optimizationproblem as the basis for our results,

p∗ = infx∈ΩCx=b

f(x) , (9.16)

with the following properties:

• f : Ω→ R is a convex function on a closed convex set Ω ⊂ RN ;

• Slater’s conditions hold;

• there exists a solution x∗ ∈ Ω such that p∗ = f(x∗) and Cx∗ = b.

Page 186: Model Based Image Processing (Text)

176 Constrained Optimization

The associated dual function for this problem is then given by

g(λ) = infx∈Ω

f(x) + λt(Cx− b)

. (9.17)

By Property 9.4, we know that the dual function takes on its maximum.

λ∗ = argmaxλ∈RK

g(λ) . (9.18)

Using this framework, we first define a cost function for the augmentedLagrangian as

L(x; a, λ) = f(x) + λt(Cx− b) +a

2||Cx− b||2 , (9.19)

where the additional term a2 ||Cx − b||2 is added in order to drive the solu-

tion towards the constraint of Cx = b. Notice that as a becomes larger,optimization will naturally tend to reduce the value of ||Cx− b||2, and there-fore enforce the constraint of Cx = b. This would appear to be an effectivepractical technique to enforce the desired constraint. However, if a is chosento be too large, then the optimization problem can become very stiff andconvergence will be very slow.

So our goal will be to find a tractable recursion for λ that will produce thecorrect value of the Lagrange multiplier. To achieve this goal, we will firstprove the following very valuable lemma.

Lemma 1. Consider the convex optimization problem of (9.16) with dualfunction of (9.17) and augmented Lagrangian of (9.19). Then for all λ ∈ R

K

infx∈Ω

L(x; a, λ) = supλ′∈RK

g(λ′)− 1

2a||λ′ − λ||2

, (9.20)

where the infimum and supremum are achieved. Furthermore, the valuesx∗∗ ∈ Ω and λ∗∗ ∈ R

K that achieve the infimum and supremum satisfy therecursion

λ∗∗ = λ+ a(Cx∗∗ − b) . (9.21)

Proof. The proof we present is adapted from [5] page 244.

We start by proving that x∗∗ and λ∗∗ must exist. First, notice that g(λ) isconcave and due to Slater’s conditions, it achieves its maximum. Therefore,

Page 187: Model Based Image Processing (Text)

9.3 The Augmented Lagrangian 177

g(λ′)− 12a ||λ′ − λ||2 must be strictly concave and must also uniquely achieve

its maximum. Next, since f(x) is convex and x∗ achieves the constrainedminimum, the set x ∈ Ω : L(x; a, λ) ≤ T must be compact for some T .Therefore, L(x; a, λ) must take on a global minimum.

Next we present a sequence of equalities that prove the equality of equa-tion (9.20).

infx∈Ω

L(x; a, λ)

= infx∈Ω

f(x) + λt(Cx− b) +a

2||Cx− b||2

= infx∈Ω,z∈RK

z=Cx−b

f(x) + λtz +a

2||z||2

= supλ′

infz∈RK ,x∈Ω

f(x) + [λ′]t(Cx− b− z) + λtz +a

2||z||2

= supλ′

infx∈Ω

f(x) + [λ′]t(Cx− b)

+ infz∈RK

(λ− λ′)tz +a

2||z||2

= supλ′

g(λ′) + infz∈RK

(λ− λ′)tz +a

2||z||2

The first equality follows from the definition of the function L(x; a, λ). Thesecond equality holds by substituting z for the expression Cx−b and applyingthe constraint that z = Cx − b. The third equality holds by introducing anew Lagrange multiplier, λ′, to enforce the constraint z = Cx − b and thenapplying the strong duality property. The fourth equality holds by collectingterms in x and z. The fifth equality holds by the definition of g(λ).

Next, we can simplify the expression in the last term by calculating theexplicit minimum. This yields the result that

g(λ′) + infz∈RK

(λ− λ′)tz +a

2||z||2

= g(λ′)− 1

2a||λ− λ′||2

where it is easily shown that the minimization over z results when

z =λ′ − λ

a. (9.22)

Using this result, we have that

infx∈Ω

L(x; a, λ) = supλ′

g(λ′) + infz∈RK

(λ− λ′)tz +a

2||z||2

Page 188: Model Based Image Processing (Text)

178 Constrained Optimization

= supλ′

g(λ′)− 1

2a||λ− λ′||2

= g(λ∗∗)− 1

2a||λ− λ∗∗||2

where λ∗∗ is defined as the value that achieves the maximum. So this provesthe first result of the lemma.

Notice that when λ′ = λ∗∗, then equation (9.22) becomes

z∗∗ =λ∗∗ − λ

a, (9.23)

where z∗∗ is the associated value of z when λ′ = λ∗∗. Now, equation (9.23)is the result of solving the constrained optimization with z = Cx − b. So inparticular, it must be that z∗∗ = Cx∗∗ − b where x∗∗ is the value of x thatachieved the minimum of L(x; a, λ). Substituting this result into (9.22) thenyields that

Cx∗∗ − b =λ∗∗ − λ

a,

and rearranging terms, then yields the final result that

λ∗∗ = λ+ a(Cx∗∗ − b) ,

which completes the proof.

With this lemma in hand, we may now introduce the augmented La-grangian algorithm as the following conceptually simple recursion in k.

x(k+1) = argminx∈Ω

L(x; a, λ(k)) (9.24)

λ(k+1) = λ(k) + a(Cx(k+1) − b) (9.25)

The optimization step of (9.24) computes the unconstrained minimum of theaugmented Lagrangian cost function with respect to x, and the update stepof (9.25) computes a very simple update of the Lagrange multiplier based onthe error in the constraint.

We can now show that these iterations converge by using Lemma 1. Fromthe lemma, we know that each update of this recursion is equivalent to thefollowing recursion in λ(k).

λ(k+1) = arg maxλ∈RK

g(λ)− 1

2a||λ− λ(k)||2

(9.26)

Page 189: Model Based Image Processing (Text)

9.3 The Augmented Lagrangian 179

In fact, it is easily shown that this iteration must converge to

limk→∞

λ(k) = λ∗ = arg maxλ∈RK

g(λ) .

Intuitively, each iteration attempts to maximize g(λ), but is restricted bythe term 1

2a ||λ−λ(k)||2 which “pulls” the solution towards the previous valueof λ(k). However, after each new iteration, this restriction becomes weaker,and the solution asymptotically converges to the global maximum of g(λ).Homework problem 6 presents a proof of convergence.

The following property states this convergence result formally.

Property 9.5. Convergence of Augmented Lagrangian - Consider the convexoptimization problem of (9.16). Then the augmented Lagrangian algorithmof equations (9.24) and (9.25) converge in the sense that

limk→∞

λ(k) = λ∗ , (9.27)

where λ∗ = argmaxλ∈RK g(λ), and

x∗ = argminx∈Ω

L(x; a, λ∗) , (9.28)

where x∗ is a solution to the constrained optimization of (9.16).

Proof. We have already proved the convergence of equation (9.27) to themaximum of the dual function g(λ). By a combination of Properties 9.4and 9.3, we know that strong duality must hold and that any solution to theconstrained optimization problem must be a solution to

x∗ = argminx∈Ω

L(x; 0, λ∗) ,

where a = 0. Since x∗ is assumed to meet the constraint, we know thatCx∗ − b = 0, and therefore that

x∗ = argminx∈Ω

L(x; a, λ∗) ,

which completes the proof.

Finally, we can reorganize the terms of the augmented Lagrangian to putit in an equivalent but slightly more compact form.

x(k+1) = argminx∈Ω

f(x) +a

2||Cx− b+ u(k)||2

(9.29)

Page 190: Model Based Image Processing (Text)

180 Constrained Optimization

Augmented Lagrangian Algorithm:

Initialize u← 0For K iterations

x ← argminx∈Ω

f(x) +a

2||Cx− b+ u||2

u ← u+ Cx− b .

Figure 9.1: Pseudocode for the implementation of the augmented Lagrangian algo-rithm for the minimization of f(x) subject to the constraint Cx = b. This iterationcan be shown to converge to the optimal value of the Lagrange multiplier u∗ thatachieves the desired constraint.

u(k+1) = u(k) + Cx(k+1) − b . (9.30)

It is easy to show that this new form is equivalent to the from of equa-tion (9.19) by expanding out the expression for a

2 ||Cx − b + u(k)||2. (Seeproblem 7) In the new form, the vector u serves the role of the Lagrangemultiplier but it is scaled so that u = λ/a. Figure 9.1 shows the resultingalgorithm in psuedocode form.

It is interesting to note that the convergence of the augmented Lagrangianalgorithm does not depend on the choice of a. In fact, a very large value of awill result in much faster convergence in terms of number of iterations. Thiscan be seen in two ways. First, if a is large, then the term a

2 ||Cx−b||2 will drivethe solution towards the constraint more rapidly. Alternatively, when 1

2a issmall, then the dual-space iteration of equation (9.26) will be less restricted bythe term 1

2a ||λ−λ(k)||2. However, the price one pays for this fast convergenceis that each iteration can be more difficult. This is because when a is verylarge, then the optimization of equation (9.29) becomes more ill-conditionedand therefore, more difficult. So the trick then becomes to balance these twoobjectives of fast convergence and well-conditioned minimization.

9.4 Shrinkage and Proximal Mappings

At this point, we take a minor detour to better understand a rather simpleoperation that reappears in a number of different contexts. Let u(x) be a

Page 191: Model Based Image Processing (Text)

9.4 Shrinkage and Proximal Mappings 181

convex function on the closed convex nonempty set Ω ⊂ RN .2 Then we

define the proximal mapping, H(y) of u(x) as

H(y) = argminx∈Ω

1

2||y − x||2 + u(x)

. (9.31)

First, we note that the proximal mapping of equation (9.31) has a simpleinterpretation. Consider the problem in which Y = X+W where W is whiteGaussian noise with unit variance and our objective is to recover X from Y .This simplest of inverse problems, known as denoising, has been the focusof enormous attention over the years. Perhaps this is due to the fact thatdenoising is not only of practical importance but also that it presents a puretheoretical problem in image modeling. Expanding on this idea, the MAPcost function for this denoising problem is given by

f(x; y) =1

2||y − x||2 + u(x)

where u(x) = − log p(x) is the convex negative log prior distribution. Fromthis, we see that the MAP estimate, x = H(y), is given by the proximalmapping of (9.31). It is also interesting to note that by substituting in u(x) =−g(x), then the proximal mapping has the same structure as the updateequation for the augmented Lagrangian in equation (9.26).

Next, we make some useful observations about the proximal mapping.First, notice that f(x; y) is a strictly convex function on Ω. Therefore, theglobal minimum must be unique, and H(y) must always be well defined fory ∈ R

N . Also, in homework problem 6, we show that iterative application ofa proximal mapping converges to the global minimum of the function u(x).So the recursion

y(k+1) = argminx∈Ω

1

2||y(k) − x||2 + u(x)

, (9.32)

converges to the minimum of u(x), or more formally

limk→∞

y(k) = argminx

u(x) .

In retrospect, this is the same reason that the augmented Lagrangian itera-tion of equation (9.26) is guaranteed to converge to the solution of the dualoptimization problem.

2 More generally, u may be an extended convex function in which case u(x) may be any proper closedconvex function f : RN → R ∪ ∞.

Page 192: Model Based Image Processing (Text)

182 Constrained Optimization

We can gain insight into the value of the proximal mapping by consideringsome illustrative special cases. One very interesting case occurs when we usethe L1 prior first discussed in Section 6.3 as the regularizing prior. In thiscase, u(x) = λ||x||1 where λ ≥ 0 is a scalar parameter, and the proximalmapping is given by

H(y) = arg minx∈RN

1

2||y − x||2 + λ||x||1

. (9.33)

Once again, since ||x||1 is a convex function, we know that the function beingminimized is a strictly convex function of x and therefore has a unique globalminimum. We can calculate the exact minimum by first noticing that thefunction being minimized is separable, so that it can be written as the sumof independent terms.

f(x; y) =N∑

i=1

1

2(yi − xi)

2 + λ|xi|

For each component, yi, the solution can therefore be computed by inde-pendently minimizing with respect to each component, xi. Minimizing withrespect to xi results in the following solution.

argminxi∈R

1

2(yi − xi)

2 + λ|xi|

=

yi − λ for yi > λ0 for |yi| ≤ λ

yi + λ for yi < −λ(9.34)

This result can be easily verified by considering the three cases. (See prob-lem 8)

The expression of equation (9.34) occurs so commonly that it has beennamed the shrinkage function. With a little bit of manipulation, we mayexpress the shrinkage function in a more compact form given by

Sλ(yi) , sign(yi)max |yi| − λ, 0 , (9.35)

where Sλ(yi) is defined as the shrinkage function applied to the scaler yi.Using this more compact notation, we can also express the solution to theproximal mapping of equation (9.33) as

arg minx∈RN

1

2||y − x||2 + λ||x||1

= Sλ(y) , (9.36)

Page 193: Model Based Image Processing (Text)

9.4 Shrinkage and Proximal Mappings 183

−4 −2 0 2 4−4

−2

0

2

4Shrinkage Function

Figure 9.2: Illustration of the shrinkage function for λ = 1. The function acts like asoft threshold that sets all values of x to zero for |x| ≤ λ, but remains continuous.

where Sλ(y) is now interpreted as applying the shrinkage function to eachcomponent of the vector y.

Figure 9.2 graphically illustrates the form of the shrinkage function. Noticethat it is a continuous function, and that values of yi with magnitude ≤ λare set to zero. Other values of yi are “shrunk” towards zero, with positivevalues being moved down, and negative values being moved up. Intuitivelyfor the denoising case, if the value of |yi| is below λ, then it seems likely thatthe component contains mostly noise; so the value is set to zero. However, ifthe value of |yi| is above λ, then it seems likely that the component containsmostly signal and it is retained, but with attenuation.

In fact, this framework extends to the more general case when our inverseproblem is based on the model Y = AX +W where A is an M ×N matrixand W ∼ N(0,Λ−1). If we assume that the components of X are i.i.d. witha Laplacian distribution, then the prior density is given by

pλ(x) = (λ/2)N exp −λ||x||1 ,

and the corresponding MAP optimization problem is then given by

x = arg minx∈RN

1

2||y − Ax||2Λ + λ||x||1

. (9.37)

Page 194: Model Based Image Processing (Text)

184 Constrained Optimization

Notice that this MAP estimate has a very similar form to the proximal map ofequation (9.36). So perhaps it is not surprising that the ICD update equationfor solving this problem will incorporate the shrinkage function. In order tosee this, we may use equation (7.13), to rewrite the MAP cost function as afunction of the single pixel in the form

fs(xs) = θ1(xs − xold) +1

2θ2(xs − xold)

2 + λ|xs|+ const

where xold is the previous value of xs, and θ1 and θ2 are given in equa-tions (7.14) and (7.15) as

θ1 = −(y − Ax)tΛA∗,s

θ2 = At∗,sΛA∗,s .

Using this simplified expression, it is possible to write the ICD update as

xs ← argminxs

1

2

((

xold −θ1θ2

)

− xs

)2

θ2|xs|

.

Notice that this update now has the form of the shrinkage operator given inequation (9.34); so the ICD update can be written as

xs ← Sλ/θ2

(

xold −θ1θ2

)

.

Figure 9.3 shows the pseudocode algorithm for computing the ICD updatesof this L1 regularized optimization problem of equation (9.37). Interestingly,in this case the ICD algorithm is provably convergent to the global minimum[1] even though the MAP cost function is not continuously differentiable andtherefore does not meet the conditions of Theorem 7.2.1. Intuitively, the ICDalgorithm converges in this case because the updated directions of the ICDalgorithm are perpendicular to the discontinuous manifolds of the L1 normthat occur when xi = 0 for any i.

However, in the more general problem with the form

x = arg minx∈RN

1

2||y − Ax||2Λ + ||Bx||1

, (9.38)

where B is an N × N matrix, then the ICD updates are not in generalconvergent to the global minimum. This means that the ICD updates can

Page 195: Model Based Image Processing (Text)

9.5 Variable Splitting and the ADMM Algorithm 185

ICD Algorithm using L1 Prior:

Initialize e← y − AxFor K iterations

For each pixel s ∈ S xold ← xs

θ1 ← −etΛA∗,s

θ2 ← At∗,sΛA∗,s

xs ← Sλ/θ2

(

xold −θ1θ2

)

e ← e− A∗,s(xs − xold) .

Figure 9.3: Pseudocode for fast implementation of the ICD algorithm with an L1

prior as shown in equation (9.37). The algorithm in guaranteed to converge to theglobal minimum of the convex cost function.

not be used to guarantee a solution to important problems such as the total-variation regularization problem of Section 6.3.

Fortunately, in the Section 9.5.1, we will introduce a very clever methodfor constrained optimization that can be used to solve problems with theform of equation (9.38).

9.5 Variable Splitting and the ADMM Algorithm

In this section, we will show how constrained optimization can be used tosolve a number of practical problems in MAP optimization through the useof two synergistic methods: Variable splitting and the ADMM algorithm[23, 25]. In fact, the two methods were informally introduced in Section 9.1in the context of enforcing positivity constraints. However, in this section,we will reexamine these two methods in a bit more general context.

So for example, consider any optimization problem with the general form

x = argminx∈Ωf(x) + g(Bx) , (9.39)

where B is a K ×N matrix, and f(x) and g(v) are convex functions.

Now to solve this problem, we will split the variable x into two variables,x and v, with the constraint that Bx = v. So then the new problem is given

Page 196: Model Based Image Processing (Text)

186 Constrained Optimization

by(x, v) = arg min

(x,v)

Bx=v

f(x) + g(v) . (9.40)

Given the constraint it must be that v = Bx, so therefore that the solutionto equations (9.39) and (9.40) must be the same.

Using the augmented Lagrangian methods of Section 9.3, we can convertthis constrained optimization problem to be an unconstrained optimizationproblem with the form

(x, v) = argmin(x,v)

f(x) + g(v) +a

2||Bx− v + u||2

, (9.41)

where u must be chosen to achieve the desired constraint that Bx = v. Nowin order to determine the correct value of the Lagrange multiplier u, we willuse the augmented Lagrangian algorithm of Figure 9.1. This results in thefollowing iteration.

Repeat(x, v) ← argmin

(x,v)

f(x) + g(v) +a

2||Bx− v + u||2

(9.42)

u ← u+Bx− v (9.43)

Now let us focus on solving the optimization of equation (9.42). In order tosolve this optimization, we can use the method of alternating minimizationspecified by the following iteration.

Repeatx ← argmin

x

f(x) +a

2||Bx− v + u||2

(9.44)

v ← argminv

g(v) +a

2||Bx− v + u||2

(9.45)

Notice that we drop the term g(v) in equation (9.44) since it is not a functionof x, and we drop the term f(x) in equation (9.45) since it is not a functionof v. Since this alternating iteration can be a form of coordinate descent fromTheorem 7.2.1, we know that this iteration should converge to the desiredsolution of equation (9.5).

Page 197: Model Based Image Processing (Text)

9.5 Variable Splitting and the ADMM Algorithm 187

ADMM algorithm for minimizing f(x) + g(Bx):

Initialize a > 0, u← 0, and v ← 0For K iterations

x ← argminx∈Ω

f(x) +a

2||Bx− (v − u)||2

(9.46)

v ← arg minv∈RK

g(v) +a

2||v − (Bx+ u)||2

(9.47)

u ← u+ Bx− v (9.48)

Figure 9.4: Pseudocode for ADMM optimization of equation (9.39). The first twoequations provide alternating optimization of the variables x and v, while the lastequation updates u according to the augmented Lagrangian method to enforce theconstraint that Bx = v.

Going back to the problem of the augmented Lagrangian, we must em-bed this alternating minimization within each iteration of the augmentedLagrangian algorithm. This would result in a nested iteration, which whilepossible, can be computationally expensive. Instead, we trust our instinctsas good irreverent engineers, and we assume that one iteration of the alter-nating minimization should be “enough”. Perhaps surprisingly, our unsavoryengineering instincts are quite correct in this case. In fact, the algorithmthat results from a single iteration of alternating minimization is the ADMMalgorithm, and it can be proved that ADMM still has guaranteed convergence[14, 19].

Figure 9.4 shows the general form of the ADMM algorithm for the prob-lem of equation (9.39). The algorithm consists of three updates performedrepeatedly until convergence. The first update of equation (9.46) minimizesthe augmented Lagrangian cost function with respect to the variable x. Thesecond update of equation (9.47) does the same for v, and the third of equa-tion (9.48) updates the variable u of the augmented Lagrangian in order toenforce the required constraint that v = Bx. One subtle but important pointis that the optimization with respect to v no longer requires the enforcementof the constraint x ∈ Ω. As we will soon see, this can provide an importantsimplification in some circumstances.

So we see that the ADMM algorithm results from a series of three tricks:

Page 198: Model Based Image Processing (Text)

188 Constrained Optimization

ADMM algorithm for Total-Variation Regularization:

Initialize a > 0, u← 0, and v ← 0For K iterations

x ← arg minx∈RN

1

2||y − Ax||2Λ +

a

2||Bx− v + u||2

(9.49)

v ← S1/a(Bx+ u) (9.50)

u ← u+ Bx− v (9.51)

Figure 9.5: Pseudocode for ADMM optimization of the total-variation regularizationproblem from equation (9.52). The first two equations provide alternating optimiza-tion of the variables x and v, while the last equation updates u according to theaugmented Lagrangian method to enforce the constraint that Bx = v.

• Split a single variable into two variables in order to separate the twoterms in the optimization

• Apply the augmented Lagrangian method to enforce consistency of thesplit variables

• Use a single iteration of alternating minimization to minimize with re-spect to each of the split variables

Based on this view, it is clear that ADMM can be used for wide range ofapplications.

Intuitively, the ADMM algorithm has many practical advantages. First,it allows different optimization methods to be used with different parts ofthe cost function. Second, the augmented Lagrangian method allows theconstraint to be relaxed during the optimization process, but ultimately en-forces it at convergence. Intuitively, this flexibility to relax the constraintduring optimization can allow the optimization algorithm to converge moreefficiently to its solution.

9.5.1 Total Variation Regularization using ADMM

In this section, we will show how variable splitting with ADMM can be ap-plied to efficiently solve the problem of total-variation regularized inversion

Page 199: Model Based Image Processing (Text)

9.5 Variable Splitting and the ADMM Algorithm 189

of equation (9.38).

For this problem, the MAP cost function is given by

f(x; y) =1

2||y − Ax||2Λ + ||Bx||1 , (9.52)

where A is a M × N forward matrix, B is a general K × N matrix, and||z||1 =

i |zi| is the L1 norm of z. As we learned in Theorem 7.2.1, the con-vergence of ICD optimization depends critically on the MAP cost functionbeing continuously differentiable. In fact, most gradient based optimizationtechniques depend on continuity of the derivative in order to achieve conver-gence. So the computation of the MAP estimate in this case seems to beproblematic.

To do this, we convert the unconstrained optimization over the singlevector x into an optimization over two vectors x ∈ R

N and v ∈ RK with the

constraint that v = Bx. So the problem becomes

(x, v) = arg min(x,v)

Bx=v

1

2||y − Ax||2Λ + ||v||1

. (9.53)

From this, we can formulate the associated augmented Lagrangian to yieldthe following iteration.

Repeat

(x, v) ← argmin(x,v)

1

2||y − Ax||2Λ + ||v||1 +

a

2||Bx− v + u||2

(9.54)

u ← u+Bx− v

Now in order to implement the ADMM algorithm, we must be able tosolve the optimization of equation (9.54) using alternating minimization ofx and v. The function is quadratic in x; so minimization with respect tothis variable is straightforward. Minimization with respect to v yields thefollowing update formula.

v ← arg minv∈RK

1

2||v − (Bx+ u)||2 + 1

a||v||1

Page 200: Model Based Image Processing (Text)

190 Constrained Optimization

So here we see that optimization with respect to v is exactly a proximalmapping with precisely the same form as given in equation (9.36). Therefore,we can express the solution in terms of the shrinkage function.

v ← S1/a(Bx+ u) (9.55)

Putting this together with the quadratic update of x, we know that the fol-lowing repetition of alternating minimizations should converge to the globalminimum of equation (9.54).

Repeat

x ← arg minx∈RN

1

2||y − Ax||2Λ +

a

2||Bx− v + u||2

(9.56)

v ← S1/a(Bx+ u) (9.57)

Figure 9.5 shows the ADMM algorithm for total-variation regularizationthat results from a single iteration of the alternating minimization. Again,this algorithm is guaranteed to converge based on theory discussed in Sec-tion 9.5.3.

9.5.2 Enforcing Convex Constraints using ADMM

The ADMM algorithm is particularly useful for enforcing convex constraintssuch as positivity. In order to illustrate this, consider the general problem of

x = argminx∈A

f(x) , (9.61)

where A ⊂ RN is a non-empty convex set and f is a convex function. Then

following the logic of Section 9.1, we can express this problem in the form

x = argminxf(x) + g(x) , (9.62)

where

g(x) =

0 if x ∈ A∞ if x 6∈ A

is a proper, closed, convex function on RN .

Page 201: Model Based Image Processing (Text)

9.5 Variable Splitting and the ADMM Algorithm 191

ADMM algorithm for Minimization with Convex Constraint:

Initialize a > 0, u← 0, and v ← 0For K iterations

x ← arg minx∈RN

f(x) +a

2||x− v + u)||2

(9.58)

v ← clipx+ u,A (9.59)

u ← u+ x− v (9.60)

Figure 9.6: Pseudocode for ADMM minimization of a convex function f(x) with apositivity constraint on x. The first two equations provide alternating optimization ofthe variables x and v, while the last equation updates u according to the augmentedLagrangian method to enforce the constraint that v = x. Importantly, equation (9.58)only requires unconstrained optimization of x.

In order to enforce the constraint, we will first split the variable x intotwo variables, x and v, such that x = v. Formally, we then represent theoptimization problem as

(x, v) = arg min(x,v)∈RN×A

x=v

f(x) + g(v) .

From this, we can derive the associated augmented Lagrangian optimizationalgorithm.

Repeat(x, v) ← arg min

(x,v)∈RN×A

f(x) + g(v) +a

2||x− v + u||2

(9.63)

u ← u+ x− v (9.64)

If we replace the optimization of equation (9.63) with the alternating mini-mization of x and v, we get the resulting ADMM algorithm minimization off with a convex constraint.

9.5.3 Convergence of ADMM Algorithm

We finish this chapter by presenting some formal results for guaranteeingconvergence of the ADMM algorithm. Our results are based on [14], but

Page 202: Model Based Image Processing (Text)

192 Constrained Optimization

with some additional context that adapts them for imaging applications.

In order to do this, we first define the following canonical constrainedoptimization,

p∗ = infx∈Ω,z∈ΦAx+Bz=b

f(x) + h(z) , (9.65)

where A ∈ RK×N ;B ∈ R

K×L; b ∈ RK with the following three properties,

• f : Ω → R and h : Φ → R are convex functions on the closed convexsets Ω ⊂ R

N and Φ ⊂ RL;

• Slater’s conditions hold;

• there exist a solution x∗ ∈ Ω and z∗ ∈ Φ such that p∗ = f(x∗) + h(z∗)and Ax∗ +Bz∗ = b.

Again, we define the augmented Lagrangian as

L(x, z; a, λ) = f(x) + h(z) + λt(Ax+Bz − b) +a

2||Ax+Bz − b||2 ,

the unaugmented Lagrangian as L(x, z;λ) = L(x, z; 0, λ), and the associateddual function as

g(λ) = infx∈Ω,z∈Φ

L(x, z;λ) .

Furthermore, the supremum of the dual function is denoted by

d∗ = supλ∈RK

g(λ) .

The ADMM optimization algorithm for this canonical problem is given inFigure 9.7. Our goal for this section is then to find conditions that guar-antee convergence of the ADMM algorithm to the global minimum of theconstrained optimization problem. To do this, we first define the concept ofa saddle point solution.

Definition 12. Saddle Point SolutionThe triple (x∗, z∗, λ∗) are said to be a saddle point solution if for allx ∈ Ω, z ∈ Φ, and for all λ ∈ R

K, we have that

L(x, z;λ∗) ≥ L(x∗, z∗;λ∗) ≥ L(x∗, z∗;λ) .

The following property states that any solution to our canonical optimiza-tion problem must be a saddle point solution.

Page 203: Model Based Image Processing (Text)

9.5 Variable Splitting and the ADMM Algorithm 193

ADMM algorithm for canonical constrained optimization:

Initialize a > 0, u← 0, and z ← 0For K iterations

x ← argminx∈Ω

f(x) +a

2||Ax+ Bz − b− u||2

(9.66)

z ← argminz∈Φ

h(z) +a

2||Ax+ Bz − b− u||2

(9.67)

u ← u+ (Ax−Bz − b) (9.68)

Figure 9.7: Pseudocode for ADMM minimization of the canonical constrained opti-mization problem of equation (9.65).

Property 9.6. Saddle Point Property - Consider the canonical constrainedoptimization problem of equation (9.65). Then

• There exists λ∗ ∈ RK such that d∗ = g(λ∗);

• The triple (x∗, z∗, λ∗) is a saddle point solution.

Proof. The canonical problem of equation (9.65) makes the assumption thatthe problem is convex in both f(x) and h(y) and that Slater’s conditionshold. Therefore, by Property 9.4 we know that strong duality holds andthere exists a λ∗ ∈ R

K such that d∗ = g(λ∗).

Since strong duality holds, then by Property 9.3, we know that for allx ∈ Ω and z ∈ Φ, L(x, z;λ∗) ≥ L(x∗, z∗;λ∗) where x∗ and z∗ are the assumedsolutions to the constrained optimization problem.

Furthermore, since x∗ and z∗ are the assumed solution, we know thatAx∗ +Bz∗ = b. So therefore, we know that for all λ ∈ R

K that

L(x∗, z∗;λ∗) = L(x∗, z∗;λ) .

With these two results, we have that

L(x, z;λ∗) ≥ L(x∗, z∗;λ∗) ≥ L(x∗, z∗;λ) ,

and the property is proved.

Page 204: Model Based Image Processing (Text)

194 Constrained Optimization

The following property then states that the ADMM algorithm convergesfor any convex optimization problem with the form of equation (9.65).

Property 9.7. Convergence of ADMM Algorithm - Consider a constrained con-vex optimization problem with the canonical form of equation (9.65). Thenthe ADMM iterations specified in Figure 9.7 converge for this problem in thefollowing precise sense,

limk→∞

Ax(k) +Bz(k) − c

= 0

limk→∞

f(x(k)) + h(z(k))

= p∗

limk→∞

u(k) =λ∗

a,

where x(k), z(k), and u(k) denote the result of the kth ADMM update.

Proof. The canonical problem of equation (9.65) makes the assumption thatx∗ and z∗ exist that are solutions to the constrained optimization prob-lem. Therefore, by Property 9.6 there must also exists a λ∗ ∈ R

K suchthat (x∗, z∗, λ∗) is a saddle point to the constrained optimization problem ofequation (9.65). In [14], it is shown that the stated convergence propertieshold when f(x) and h(x) are closed proper convex functions, and (x∗, z∗, λ∗)is a saddle point solution. So the proof is complete.

Page 205: Model Based Image Processing (Text)

9.6 Chapter Problems 195

9.6 Chapter Problems

1. Let f :A → R is a convex function on the non-empty convex set A ⊂ RN ,

and furthermore define the extended function

g(x) =

f(x) if x ∈ A∞ otherwise

.

Then prove that g :RN → R is a proper, closed, and convex function.

2. Consider the optimization problem

x = arg minx∈R+N

Cx−b∈R+N

f(x) ,

where x ∈ RN , b ∈ R

K , and C ∈ RK×N . Then define the new vector

z =

[

x

y

]

where y ∈ RK and y = Cx − b. Then show that there is an equivalent

constrained optimization problem with the form

x = arg minz∈R+N

Bz=c

f(z) ,

for some appropriately chosen matrix B and vector c. The variable y issometimes referred to as a slack variable.

3. Show that for any function f : A×B → R the following inequality holds.

infy∈B

supx∈A

f(x, y) ≥ supx∈A

infy∈B

f(x, y)

4. Let f(x) be continuously differentiable on Ω = RN and let x(λ), the

solution to equation (9.9), also be continuously differentiable on λ ∈ D.Then show that the gradient of the dual function is given by

∇g(λ) = Cx(λ)− b .

5. Consider the constrained optimization problem of equation (9.6). Showthat when the primal function f(x) is continuously differentiable on R

N ,then λ∗ achieves a maximum of the dual function g(λ) if and only if theconstraint Cx(λ∗)− b = 0 is met and in this case p∗ = d∗.

Page 206: Model Based Image Processing (Text)

196 Constrained Optimization

6. In this problem, we prove that repeated application of a proximal map-ping of a convex function u(x) converges to its global minimum.3 Letu(x) be a continuously differentiable convex function on Ω ⊂ R

N , anddefine the proximal mapping function as

H(y) = argminx∈Ω

||y − x||2 + u(x)

. (9.69)

Furthermore, define the function f(x, y) = ||y − x||2 + u(x).

a) Show that the following equality holds

miny∈RN ,x∈Ω

f(x, y) = minx∈Ω

u(x) ,

and that the minimum is achieved by the same value of x on both theleft and right sides.

b) Use Theorem 7.2.1 to show that the following recursion must convergeto the minimum of f(x, y).

x(k+1) = argminx∈Ω

f(x, y(k))

y(k+1) = arg miny∈RN

f(x(k+1), y) ,

c) Show that the recursion of part b) above has the form

y(k+1) = H(y(k)) ,

and that limk→∞ y(k) = x∗ where x∗ achieves the minimum u(x).

7. Let

L(x; a, λ) = f(x) + λt(Cx− b) +a

2||Cx− b||2

L(x; a, u) = f(x) +a

2||Cx− b+ u||2 ,

where f : RN → R and λ = au. Then show that x∗ achieves a localminimum of L if and only if it achieves a local minimum of L.

8. Show that the shrinkage operator of equation (9.35) is the solution tothe following minimization operation.

argminxi

1

2σ(yi − xi)

2 + |xi|

= Sσ(yi)

3 For simplicity, we will assume that u(x) is continuously differentiable, but the same result holds withoutthis assumption.

Page 207: Model Based Image Processing (Text)

9.6 Chapter Problems 197

9. Consider the MAP cost function given by

f(x; y) = ||y − Ax||2 + ||x||1where x and y are vectors in R

N , ||x||1 is the L1 norm of x, and A is afull rank matrix in R

N×N .

a) Prove that f(x; y) is a strictly convex function of x.

b) Calculate a closed form expression for the ICD update.

c) Prove that this function takes on a local minimum which is also itsunique global minimum.

d) We say that, x∗, is a fixed point of the ICD algorithm if a full ICDupdate using an initial value of x∗ produces an updated value of x∗.Using this definition, prove that x∗ is a fixed point of the ICD algorithmif and only if it is a global minimum of f(x; y).

10. Consider the problem

x = arg minx∈R+N

f(x) ,

where f :RN → R is a convex function. In order to remove the constraint,we may define the proper, closed, convex function

g(x) =

0 if x ∈ R+N

∞ if x 6∈ R+N .

Then the minimum is given by the solution to the unconstrained opti-mization problem

x = arg minx∈RN

f(x) + g(x) . (9.70)

Using this formulation, do the following.

a) Use variable splitting to derive a constrained optimization problemthat is equivalent to equation (9.70).

b) Formulate the augmented Lagrangian for this constrained optimiza-tion problem and give the iterative algorithm for solving the augmentedLagrangian problem.

c) Use the ADMM approach to formulate an iterative algorithm forsolving the augmented Lagrangian.

Page 208: Model Based Image Processing (Text)

198 Constrained Optimization

d) Simplify the expressions for the ADMM updates and give the generalsimplified ADMM algorithm for implementing positivity constraints inconvex optimization problems.

Page 209: Model Based Image Processing (Text)

Chapter 10

Model Parameter Estimation

The focus of the previous chapters has been on the estimation of an unknownimage X from measurements Y . However, in real applications there are oftena variety of model parameters that must also be estimated. So for example,in an imaging system there are typically calibration parameters that controlfocus or data fidelity that must be accurately estimated in order to achievehigh quality results. While in principle it might seem that these parameterscan be determined in advance through a calibration or training procedure, inpractice this is often impractical, particular when these parameters tend todrift with time.

A huge practical advantage of model-based methods is that they providea principled framework to estimate model parameters as part of the recon-struction process. This avoids the need to do difficult or sometimes impos-sible calibration measurements, and it makes the reconstruction algorithmsadaptive to variations in both image statistics and system calibration. Thefollowing chapter introduces a variety of methods for estimation of system andprior parameters, and also introduces the challenging problem of estimatingdiscrete model order.

10.1 Parameter Estimation Framework

In practical problems, there are often unknown parameters for both the for-ward and prior models. So for example, the amplitude of measurement noiseor the point-spread function of a sensor are quantities that can be mod-eled as unknown parameters. In addition, parameters such as the scaling

Page 210: Model Based Image Processing (Text)

200 Model Parameter Estimation

XRandom Field Model

θ

Physical SystemY

Data Collection

φFigure 10.1: A very powerful aspect of model-based methods is that they provide aframework for the estimation of unknown hyper-parameters as part of the inversionprocess. These hyper-parameters can represent either unknown parameters of thesystem model, φ, or unknown parameters of the prior model, θ.

parameter in an MRF prior model, as discussed in Section 6.4, is a classicexample of an unknown parameter that is essential to know in order to ob-tain an accurate MAP estimate. These extra parameters, collectively knownas hyper-parameters or perhaps more classically as nuisance parame-ters, are often not of direct interest, but are required in order to make goodestimates of X.

Figure 10.1 illustrates our basic approach. The variable φ will be usedto represent unknown parameters of the imaging system. So for example,parameters dealing with the system PSF, noise calibration, or data offsetsmight be parameterized by φ. The variable θ will be used to represent un-known parameters of the prior model. This will include the all importantregularization parameters that must typically be estimated in order to get aestimate of X that is neither over nor under smoothed.

One relatively simple and intuitive approach to estimating φ and θ is tojointly minimize the MAP cost function with respect to all the unknownquantities [47]. This results in

(x, θ, φ) = argminx,θ,φ− log p(y|x, φ)− log p(x|θ) . (10.1)

We will refer to this as the joint-MAP estimate of (x, θ, φ) because it canbe viewed as a MAP estimate using uniform priors on the parameters1. Thisjoint estimate has the intuitive appeal of seeming to be a joint MAP estimateof X and a ML estimate of (θ, φ); however, in fact it is neither, and thereforeit inherits the properties of neither. In fact, we will see that in many typicalcases, this estimator is not even consistent. This is perhaps surprising sincethe ML estimator is generally consistent, but in fact, the ML estimate of

1Such a prior is, of course, improper, but nonetheless can be convenient to assume in practice.

Page 211: Model Based Image Processing (Text)

10.2 Noise Variance Estimation 201

(θ, φ) requires that the variable x be integrated out of the distributions, sinceit is not directly observed. More specifically, the ML estimate is given by

(θ, φ) = argminθ,φ

−∫

p(y|x, φ)p(x|θ)dx

. (10.2)

This estimator is generally consistent, but is usually much more computa-tionally expensive to compute since it requires high dimensional integrationover x. In fact, the entire development of the expectation-maximization al-gorithm presented in Chapter 11 is designed to address this very issue. Butin many cases, even the EM algorithm requires the numerical computationof a high dimensional integral. Addressing this case will require the use ofthe stochastic sampling techniques introduced in Chapter 14.

Nonetheless, we will find that for many important applications, the joint-MAP estimate works great. The key is to understand the estimator’s strengthsand weaknesses, so that it can be used in applications that are appropriate.Its advantage is that it is often easy to implement, and requires little addi-tional computation, and when it works, it typically can give very accurateestimates of parameters since the dimension of θ and φ are typically quitelow.

10.2 Noise Variance Estimation

Typically, the joint-MAP estimation of system parameters, φ, works well, andis easy to implement. In practice, φ can represent a wide variety of unknownphysical parameters in sensing systems, so the ability to automatically esti-mate these parameters as part of the MAP estimation procedure is a hugeadvantage.

In order to illustrate how this is done, let’s consider a simple and usefulcase of estimating the unknown noise gain in a measurement system. Soconsider the case where

Y = AX +W

where W is distributed as N(0, σ2Λ−1), so the inverse covariance of the ad-ditive noise is given by 1

σ2Λ where σ2 is an unknown scaling constant. Thissituation occurs commonly when the relative noise of measurements is known,but the overall gain of the noise is unknown. For example, it is common in

Page 212: Model Based Image Processing (Text)

202 Model Parameter Estimation

imaging systems for the conditional distribution of Y given X to have a Pois-son distribution with mean AX. The Poisson noise model often results fromthe “shot” or photon counting noise when quanta of energy are detected inphysical sensors. In this case, the noise can be approximated by indepen-dent additive Gaussian noise with mean zero and variance proportional tothe amplitude of the signal Y [58].

So consider a system where each measurement Yi is formed by amplifyinga Poisson random variable λi by an unknown gain constant α. In practice,this happens in an “integrating detector” system in which the underlyingsignal, λi, is the Poisson random variable generated by some kind of photoncounting process. An analog amplifier with a gain of α then produces thesignal Yi = αλi that is converted to digital form and processed on a computer.Using this model, it can be easily shown that

Var[Yi|X] = αE[Yi|X]

where α is an unknown gain constant that effects the overall level of noisevariance.

A common assumption in this case is to assume that Yi are indepen-dent Gaussian random variables. So then the vector is distributed as Y ∼N(AX,αΛ−1) where Λ is a diagonal matrix with diagonal entries of

αΛ−1i,i ∝ E[Yi|X] .

However, even though Λ is known, it is often the case that the gain, αmust still be estimated. In order to do this, we first write out the MAP costfunction.

f(x, α; y) = − log p(y|x, α)− log p(x)

=1

2α||y − Ax||2Λ +

M

2log (α)− 1

2log (|Λ|)− log p(x) (10.3)

Interestingly, this function can be minimized with respect to α in closed formto yield

α = argminσ2

f(x, α; y)

=1

M||y − Ax||2Λ .

Page 213: Model Based Image Processing (Text)

10.2 Noise Variance Estimation 203

Noise Variance Estimation using Alternating Minimization:

Initialize x and σ2

For K iterations //Compute the MAP estimate using σ2 = σ2.

x← argminx∈Ω

1

2α||y − Ax||2Λ − log p(x)

//Compute ML estimate of σ2 using x = x.

α← 1

M||y − Ax||2Λ .

Figure 10.2: Pseudocode for alternating minimization of the MAP cost function withrespect to both x and σ2. Each step monotonically reduces the cost of equation (10.4).

Then substituting this estimate of the noise variance into the MAP costfunction, results in the following expression.

f(x, α; y) =M

2(1− logM) +

M

2log(

||y − Ax||2Λ)

− 1

2log (|Λ|)− log p(x)

So from this, we can see that joint-MAP estimation will result in an estimateof x that minimizes a modified cost function given by

f(x; y) =M

2log(

||y − Ax||2Λ)

− log p(x) . (10.4)

Notice that in this form, we have removed any dependency on the unknownnoise gain, α, by replacing the norm squared term with its log. Minimizationof this modified cost function results in the joint-MAP estimate of X givenby

x = argminx∈Ω

M

2log(

||y − Ax||2Λ)

− log p(x)

.

This modified cost function, f(x; y), is useful for tracking convergence ofoptimization algorithms, but in practice, direct minimization of this costfunction is usually not the best approach. Usually, the best approach tominimizing equation (10.4) is to alternately minimize the joint MAP costfunction of equation (10.3) with respect to x and α.

Figure 10.2 provides a pseudocode example of how this alternating mini-mization approach is performed. First the MAP estimate of x is computed

Page 214: Model Based Image Processing (Text)

204 Model Parameter Estimation

under the assumption that α = α, and then the ML estimate of α is com-puted using the estimate of x = x. Each step of this procedure monotonicallydecreases the value of the modified MAP cost function in equation (10.4). Sothe process can be repeated until convergence is achieved.

10.3 Scale Parameter Selection and Estimation

Perhaps the most important parameter to be selected in MAP estimation isthe scale parameter of the prior distribution, σx. Section 6.4 presented verytractable methods for computing the ML estimate of σx given observations ofthe MRF, X. However, in the problem of MAP estimation, X, is unknown;so it is not observed directly. We will see that one solution to this dilemmaof incomplete data is to employ the techniques of the EM algorithm andstochastic sampling, to be discussed in Chapters 11 and 14. However, even inthe best of situations, these approaches can be very computational expensive,so alternative methods are usually needed in practice.

In fact, scale parameter estimation has been studied for many years andis still a problem of great interest to the research community; so a consen-sus on the best approach has yet to emerge. Moreover, while very effectivetechniques do exist, they tend to be tuned to a specific class of applicationsand/or be very computational expensive. One issue that makes the selectionof σx so difficult is that its actual value can vary dramatically based on theunits and scale of the quantity X. So if individual pixels in X representinterplanetary distances, and the units are meters, then we might expect anappropriate value for σx to be quite large. However, if the quantities beingmeasured are molecular distances, but with the same units of meters, thenσx will be many orders of magnitude smaller. Another challenge is that the“best” value of σx typically depends on the specific use of the image X beingestimated. In some applications, it maybe more important to reduce noisein X at the cost of additional smoothing, but in other applications, it mightbe more important to retain detail. In practice, what is typically needed is aunitless quantity to adjust in a limited range that allows resolution and noiseto be controlled about a reasonable nominal value.

One approach to the selection of σx is to use the joint-MAP estimator ofequation (10.1). Assuming a Gibbs distribution with energy function u(x/σx),

Page 215: Model Based Image Processing (Text)

10.3 Scale Parameter Selection and Estimation 205

then the prior distribution is given by

p(x) =1

z0σNx

exp −u(x/σx) , (10.5)

where N is the dimension of x. So in this case, the MAP cost function isgiven by

f(x, σx; y) = − log p(y|x) + u(x/σx) +N log(σx) . (10.6)

This function can be minimized by alternately minimizing with respect to xand σx. Minimization with respect to x is performed using the MAP estima-tion techniques we have discuss throughout this chapter, and the minimiza-tion of with respect to σx can be done by numerically rooting equation (6.22)of Section 6.4.

However, in practice, there is a serious problem with estimaton of σxthrough the joint minimization of (10.6). The problem is that algorithms forminimization of (10.6) typically converge to the global minimum at σx = 0! Infact, after a bit of thought, it is clear that when x = 0, then limσx→0 f(0, σx; y) =−∞, so that σx = 0 is always a global minimum.2

A somewhat ad-hoc but useful approach to fixing this problem is to intro-duce a unitless adjustable sharpening factor, γ > 1, which a user can tune toachieve the desired level of regularization. This sharpening parameter can beadjusted without knowing the scale of X, so as to achieve the desired levelof sharpness in the reconstruction. Using this procedure, the modified costfunction is given by

f(x, σx; y, γ) = − log p(y|x) + u(x/σx) +N

γlog(σx) , (10.7)

where γ is inserted as a way of attenuating the attraction of σx towards 0. Sousing the methodology described in Section 6.4, the update of σx is computedby minimizing the cost function of equation (10.7), and this is done by rootingthe following equation.

γσxN

d

dσxu(x/σx)

σx=σx

= −1 (10.8)

2 The existence of a minimum at σx = 0 is not necessarily so bad since for many problems, such as forexample the estimation of the parameters of a Gaussian mixture model (as described in Section 11.2), thereis an undesirable global minimum when the variance parameter is zero and a cluster contains only a singlesample. However, the estimation of σx in MAP estimation is of greater concern because, in practice, thereis often not even a local minimum to the cost function for which σx is bounded away from zero.

Page 216: Model Based Image Processing (Text)

206 Model Parameter Estimation

We can get more intuition into this procedure by considering the specialcase when the prior is a MRF using a GGMRF potential function so that

u(x) =1

pσpx

s,r∈Pbs,r|xs − xr|p . (10.9)

In this case, the cost function of (10.7) can be minimized by alternating min-imization with respect to the quantities x and σx. This is done by repeatingthe following two update procedures.

x ← argminx∈Ω

− log p(y|x) + 1

pσpx

s,r∈Pbs,r|xs − xr|p

(10.10)

σpx ←

γ

N

s,r∈Pbs,r|xs − xr|p . (10.11)

So notice that in this procedure the estimated value of σx is increase bya factor of γ with each iteration. This gain factor reduces the amount ofregularization and helps to compensate for the systematic underestimationof σx that tends to occur in a joint-MAP estimation procedure of this kind.The sharpening factor, γ > 1, can also be used to adjust the amount ofregularization to suit the application. So a large value of γ will result in asharper image with less regularization.

Another problem that commonly arises is the need to adjust the scaleparameter, σx, as the sampling resolution of an image is changed. So forexample, consider the case when Xs is an image on a discrete rectangularlattice with sample spacing h in each dimension. This occurs when Xs isa discretely sampled representation of an underlying continuous space func-tion. More specifically, the discrete function Xs is often a representation ofa continuous function f : Rd → R, where f(hs) = Xs. In other words, f(u)is then a continuous function of u ∈ R

d, and Xs is a sampled version of f(u)for u = hs.

So in this type of application, our underlying objective is to recover thecontinuous function, f(u), and we may want or need to change the choice ofh used in the MAP reconstruction problem. For example, sometimes multi-resolution methods are used to solve the MAP reconstruction problems atdifferent resolutions. For each of these resolutions, the value of h will change,

Page 217: Model Based Image Processing (Text)

10.3 Scale Parameter Selection and Estimation 207

but we would like the underlying estimation problem for f(u) to remain thesame. In order to do this, we need to scale the prior term of the MAP costfunction so that it remains approximately constant as h changes.

We can make the MAP estimate approximately invariant to the samplespacing, h, by scaling the energy function of the prior so that it has thefollowing normalized form,

u(x) = hd∑

s,r∈Pbs−rρ

(

xs − xrh

)

. (10.12)

where we assume that s takes values on a d-dimensional rectangular latticeand bs−r is only a function of the vector difference between the indices s andr. Then the following series of approximate equalities illustrate how as hbecomes small, this energy function converges toward the Riemann sum of acontinuous integral.

u(x) = hd∑

s,r∈Pbs−rρ

(

xs − xrh

)

=hd

2

s∈S

r∈Wbrρ

(

xs+r − xsh

)

≈ 1

2

r∈Wbr∑

s∈Shdρ(

rt∇f(hs))

≈ 1

2

r∈Wbr

Rd

ρ(

rt∇f(u))

du ,

where the fourth line uses the Riemann sum approximation of an integral,and the third line uses the fact that

xs+r − xsh

=f(hs+ hr)− f(hs)

h

≈ hrt∇f(hs)h

= rt∇f(hs) .

From this result, we can see that the normalized energy function of equa-tion (10.12) is approximately invariant to the choice of h.

Page 218: Model Based Image Processing (Text)

208 Model Parameter Estimation

10.4 Order Identification and Model Selection

Page 219: Model Based Image Processing (Text)

10.5 Chapter Problems 209

10.5 Chapter Problems

1. The following problems deal with joint estimation of x and σ2x.

(a) Derive an expression, analogous to (10.2) for the joint estimation ofx and σ2

x.

(b) Would this be a good estimator? Why or why not?

Page 220: Model Based Image Processing (Text)

210 Model Parameter Estimation

Page 221: Model Based Image Processing (Text)

Chapter 11

The Expectation-Maximization (EM)Algorithm

Hopefully, the previous chapters have convinced you that the methods ofmodel-based image processing are quite promising. However, one crucialquestion that arises is how should the model be chosen? Clearly, a poorchoice of models will produce bad results, so this is a critical question.

One solution to this problem is to select a broad family of models that arecontrolled by a scalar or vector parameter. So for example, the prior modelfor an image may be controlled by a parameter which determines propertiessuch as variation or edginess. These model parameters can then be estimatedalong with the unknown image. If the family of models is sufficiently broad,and the parameter estimation is sufficiently robust, then it should be possibleto select a model from the family that accurately describes the data.

However, there is still a catch with this approach: The undistorted imageis typically not available. In fact, if it were available, then we would notneed to solve the image restoration or reconstruction problem in the firstplace. This means that the parameters that specify a particular prior modelmust be estimated from indirect measurements of the corrupted, distorted,or transformed image.

In fact, the problem of estimating parameters from indirect or incompleteobservations is a recurring theme in model-based image processing. Fortu-nately, there are some powerful tools that can be used to address this prob-lem. Among these tools, the expectation-maximization (EM) algorithmis perhaps the most widely used. At its core, the EM algorithm provides atwo-step process for parameter estimation. In the first step, one conjectures

Page 222: Model Based Image Processing (Text)

212 The Expectation-Maximization (EM) Algorithm

true mean

meanestimated

mean

fertilized plantsunfertilized plants

Histogram of Labeled Plant Heights

all plants

Histogram of Unlabeled Plant Heightdecision boundary

assumed to be unfertilized assumed to be fertilized

true mean

estimated

Figure 11.1: Example of the distribution we might expect in plant height for thetwo populations. Notice that the distributions for fertilized and unfertilized plantsare different, with the fertilized plants having a larger mean height. However, if thelabels of the plants are unknown, then the distribution appears to have two modes, asshown in the second plot. Notice that naive estimates of the mean, are systematicallyoffset from the true values.

values for the missing data and uses them to calculate an ML estimate of theunknown parameters (M-step); and in the second step, the conjectured val-ues are updated using the estimated parameter values (E-step). The two-stepprocess is then repeated, with the hope of convergence.

This cyclic process is quite intuitive, but will it work? In fact, naiveimplementation of this approach leads to very bad estimates. However, theEM algorithm provides a formal framework for this iterative heuristic, whichensures well defined properties of convergence and good behavior.

The following Sections 11.1 and 11.2 first provide some informal motivationfor the EM algorithm and its primary application in data clustering withGaussian mixtures. Section 11.3 next builds the theoretic foundation andgeneral form of the EM algorithm as it applies to many applications. Latersections develop the tools and motivate its use in an array of signal processingand imaging applications.

Page 223: Model Based Image Processing (Text)

11.1 Motivation and Intuition 213

11.1 Motivation and Intuition

Imagine the following problem. You have measured the height of each plantin a garden. There are N plants, and you know that some have been regularlyfertilized, and the remainder have not been fertilized at all. Unfortunately,the fertilizing records were lost. Your measurements, Yn, of the plant heightfor the nth plant could have been modeled as Gaussian with mean µ andvariance σ2, if they had all been treated equally; but since they have not, thefertilized plants will, on average, be taller.

We can model this unknown treatment of the plants by a random variable

Xn =

1 if plant has been fertilized0 if plant has not been fertilized

.

Now ifXn were known, then the distribution of plant heights for each categorycould be assumed to be Gaussian, but with different means, and perhaps thesame variance σ2. This implies that the conditional distribution of Yn givenXn will be Gaussian,

p(yn|xn) =

1√2πσ2

exp

− 1

2σ2(yn − µ1)

2

for xn = 1

1√2πσ2

exp

− 1

2σ2(yn − µ0)

2

for xn = 0 ,

with µ0 and µ1 denoting the means of the two different classes.

It might also be reasonable to assume the class labels of the plants, Xn,are i.i.d. Bernoulli random variables with

p(xn) =

π1 for xn = 1π0 = 1− π1 for xn = 0 ,

where πi parameterizes the Bernoulli distribution.

This type of stochastic process is sometimes referred to as a doublystochastic process due to its hierarchical structure, with the distribu-tion of Yn being dependent on the value of the random variable Xn. Theparameters of this doubly stochastic process, (Xn, Yn), are then given byθ = [π0, µ0, π1, µ1] where π0 + π1 = 1.

The question arises of how to estimate the parameter θ of this distribution?This is an important practical problem because we may want to measure the

Page 224: Model Based Image Processing (Text)

214 The Expectation-Maximization (EM) Algorithm

effect of fertilization on plant growth, so we would like to know how muchµ0 and µ1 differ. Figure 11.1 illustrates the situation. Notice that the twopopulations create two modes in the distribution of plant height. In orderto estimate the mean of each mode, it seems that we would need to knowXn, the label of each plant. However, casual inspection of the distribution ofFigure 11.1 suggests that one might be able to estimate the unknown means,µ0 and µ1, by looking at the combined distribution of the two populations.

One possibility for estimating µ0 and µ1 is to first estimate the labelsXn. This can be done by applying a threshold at the valley between thetwo modes, and assigning a class of “fertilized” (Xn = 1) or “unfertilized”(Xn = 0) to each plant.

Xn =

1 Yn ≥ threshold0 Yn < threshold

(11.1)

The result of this classification can be compactly represented by the two setsS0 = n : Xn = 0 and S1 = n : Xn = 1. Using this notation, we canestimate the two unknown means as

µ0 =1

|S0|∑

n∈S0

Yn

µ1 =1

|S1|∑

n∈S1

Yn ,

where |S0| and |S1| denote the number of plants that have been classified asunfertilized and fertilized respectively.

While this is an intuitively appealing approach, it has a very serious flaw.Since we have separated the two groups by their height, it is inevitable thatwe will measure a larger value for µ1 than we should (and also a smaller valueof µ0 than we should). In fact, even when the two means are quite differentthe resulting estimates of µ0 and µ1 will be systematically shifted no matterhow many plants, N , are measured. This is much worse than simply beingbiased. These estimates are inconsistent because the estimated values do notconverge to the true parameters as N →∞.

Another approach to solving this estimation problem is to attempt todirectly estimate the value of the parameter vector θ = [π0, µ0, π1, µ1] fromthe data Y using the ML estimate. Formally, this can be stated as

θ = argmaxθ∈Ω

log p(y|θ) .

Page 225: Model Based Image Processing (Text)

11.2 Gaussian Mixture Distributions 215

This seems to be a much more promising approach since it is known that theML estimate is not only consistent, but it is asymptotically efficient. (SeeSection 2.3.) However, there is still a problem. The distribution p(y|θ) is notexplicitly available for this problem. In fact, it requires the evaluation of asum that makes direct ML estimation difficult.

p(y|θ) =∑

x

p(y|x, θ)p(x|θ)

So we will see that it is no longer possible to calculate simple closed formexpressions for the ML estimate of θ.

The purpose of the expectation-maximization (EM) algorithm is to providea systematic methodology for estimating parameters, such as µk, when thereis missing data. For this problem, we refer to the unknown labels, X, asthe missing data; the combination of (X, Y ) as the complete data; andY alone as the incomplete data. The EM algorithm provides a method tocompute an ML estimate of the parameter vector, θ, from the incomplete dataY . We will see that the derivation of the EM algorithm is quite ingenious;but in the end, the resulting algorithms are very intuitive. In fact, the EMalgorithm is more than a simple algorithm. It is a way of thinking aboutincomplete observations of data, and the associated optimization algorithmsrequired for ML parameter estimation.

11.2 Gaussian Mixture Distributions

Imagine a generalization of our example of the previous section in whichthe random variables YnNn=1 are assumed to be conditionally Gaussian andindependent given the class labels XnNn=1. In order to be a bit more general,we will also assume that each label takes on M possible values. So thatXn ∈ 0, · · · ,M − 1.

Figure 11.2 graphically illustrates the behavior of the model. Each ob-servation can come from one of M possible Gaussian distributions, and theselection of the specific Gaussian distribution is made using a switch con-trolled by the class label Xn. So for the mth Gaussian distribution, the meanand variance are denoted by µm and σ2

m and the distribution is denoted byN(µm, σ

2m). Using this notation, if the control variable takes on the value

m = xn, then Yn is conditionally Gaussian with mean µxnand variance σ2

xn.

Page 226: Model Based Image Processing (Text)

216 The Expectation-Maximization (EM) Algorithm

Yn

Gaussian N(µ0, σ20) Random Variable

Gaussian N(µM−1, σ2M−1) Random Variable

Xn control selection

Gaussian N(µ1, σ21) Random Variable

Figure 11.2: This figure graphically illustrates the creation of a random variable Yn

with a Gaussian mixture distribution. The output is selected among M possibleGaussian distributions using a switch. The switch is controlled using an independentrandom variable, Xn, that represents the class label.

With this model and notation, the conditional distribution of Yn given Xn

can be explicitly written as

p(yn|xn) =1

2πσ2xn

exp

− 1

2σ2xn

(yn − µxn)2

,

where µxnand σ2

xnare the mean and variance of the sample when xn is the

label. From this, we can calculate the marginal distribution of yn given by

p(yn) =M−1∑

m=0

p(yn|m)πm

=M−1∑

m=0

πm√

2πσ2m

exp

− 1

2σ2m

(yn − µm)2

, (11.2)

where πm = PXn = m. If we further assume that the samples, Yn, arei.i.d., then the distribution of the entire sequence, YnNn=1, can be written as

p(y) =N∏

n=1

M−1∑

m=0

πm√

2πσ2m

exp

− 1

2σ2m

(yn − µm)2

. (11.3)

A distribution with this form of (11.2) is known as a Gaussian mixturedistribution with parameter vector θ = [π0, µ0, σ

20, · · · , πM−1, µM−1, σ2

M−1].Gaussian mixtures are very useful because, for sufficiently large M , theycan approximate almost any distribution. This is because, intuitively, any

Page 227: Model Based Image Processing (Text)

11.3 Theoretical Foundation of the EM Algorithm 217

density function can be approximated by a weighted sum of Gaussian densityfunctions.

So the next question is, how can we estimate the parameter θ from theobservations of Yn? For now, we will make the simplifying assumption that weknow both the values Yn and their associated labels Xn. In order to calculatethe ML estimate, we first compute Nm, the number of labels taking on classm given by

Nm =N∑

n=1

δ(Xn −m) ,

where δ(k) is 1 when k = 0 and zero otherwise. From this, we can computethe ML estimate of πm as the fraction of labels taking on the class m.

πm =Nm

NThe ML estimate of the mean for each class is then computed by only aver-aging the values of Yn with the class label Xn = m.

µm =1

Nm

N∑

n=1

Ynδ(Xn −m)

Finally, the ML estimate of the variance for each class is computed by onlysumming over terms with the class label Xn = m.

σ2m =

1

Nm

N∑

n=1

(Yn − µm)2 δ(Xn −m)

Of course, for our problem the class labels, Xn, are not known; so theproblem remains of how we are going to calculate the ML estimate of θ fromonly the incomplete data Y . The EM algorithm provides a solution in theform of an algorithm for computing the ML parameter estimate that does notrequire the missing data. In essence, this is done by replacing the unknownlabels, Xn, with their expected values. However, in order to fully understandthis, we must first introduce the underlying theory of the method.

11.3 Theoretical Foundation of the EM Algorithm

In this section, we derive the mathematical relationships that serve as a foun-dation for the EM algorithm. While these relationships may seem abstract,

Page 228: Model Based Image Processing (Text)

218 The Expectation-Maximization (EM) Algorithm

they are relatively simple to derive, and are very powerful, so the reader isstrongly encouraged to take the time to understand them. An early, succinct,general, and clear presentation of these results can be found in [3, 2].

The EM algorithm is based on two non-obvious mathematical insights.The first insight is that one can separate the log likelihood into the sum oftwo functions. In particular, the log likelihood can be expressed as

log p(y|θ) = Q(θ; θ′) +H(θ; θ′) (11.4)

where θ′ is any value of the parameter, and the functions Q and H are definedas

Q(θ; θ′) , E[log p(y,X|θ)|Y = y, θ′] (11.5)

H(θ; θ′) , −E[log p(X|y, θ)|Y = y, θ′] . (11.6)

where p(y, x|θ) is assumed to be strictly positive density function. In orderto prove that the result of (11.4) holds, we first observe the following twoequalities.

p(y|θ) = p(y, x|θ)p(x|y, θ) =

p(y,X|θ)p(X|y, θ)

The first equality is simply a result of conditional probability that must holdfor all values of x. Since this equality holds for all x, it must in particularhold if we substitute in the random variable X. Using these identities, thefollowing sequence of equalities then proves the desired result.

log p(y|θ) = E[ log p(y|θ)|Y = y, θ′]

= E

[

log

p(y,X|θ)p(X|y, θ)

Y = y, θ′]

= E[log p(y,X|θ)|Y = y, θ′]− E[log p(X|y, θ)|Y = y, θ′]

= Q(θ; θ′) +H(θ; θ′)

The second insight is that the functionH(θ; θ′) takes on its minimum valuewhen θ = θ′. More precisely, for all θ, θ′ ∈ Ω, we have that

H(θ; θ′) ≥ H(θ′; θ′) . (11.7)

To see that this is true, we have the following set of inequalities

0 = log

p(x|y, θ)dx

Page 229: Model Based Image Processing (Text)

11.3 Theoretical Foundation of the EM Algorithm 219

= log

p(x|y, θ)p(x|y, θ′)p(x|y, θ

′)dx

≥∫

log

p(x|y, θ)p(x|y, θ′)

p(x|y, θ′)dx

=

log p(x|y, θ)p(x|y, θ′)dx−∫

log p(x|y, θ′)p(x|y, θ′)dx

= −H(θ; θ′) +H(θ′; θ′) ,

where the third line depends on the famous Jensen’s inequality whichstates that a concave function of the expectation is greater than or equal tothe expectation of the concave function.

The two results of equations (11.4) and (11.7) now admit the foundationof the EM algorithm. If we adjust the parameter from an initial value of θ′

to a new value of θ, then the change in the log likelihood is lower boundedby the change in the Q function. This is formally stated as

log p(y|θ)− log p(y|θ′) ≥ Q(θ; θ′)−Q(θ′; θ′) . (11.8)

The proof of this key result is then quite simple.

log p(y|θ)− log p(y|θ′) = Q(θ; θ′) +H(θ; θ′)− [Q(θ′; θ′) +H(θ′; θ′)]

= Q(θ; θ′)−Q(θ′; θ′) +H(θ; θ′)−H(θ′; θ′)

≥ Q(θ; θ′)−Q(θ′; θ′)

In fact, by rearranging the terms of equation (11.8), we obtain the definingproperty of a surrogate function, as defined in equation (8.7) of Chapter 8.

log p(y|θ) ≥ Q(θ; θ′)−Q(θ′; θ′) + log p(y|θ′) . (11.9)

So we see that the function Q(θ; θ′) is a surrogate function for the maximiza-tion of log p(y|θ). As with any surrogate function, optimization of Q ensuresoptimization of the likelihood; so we have the following.

Q(θ; θ′) > Q(θ′; θ′)⇒ p(y|θ) > p(y|θ′) (11.10)

From this result, the central concept of the EM algorithm becomes clear.Each iteration starts with an initial parameter θ′. Our objective is then tofind a new parameter θ so that Q(θ; θ′) > Q(θ′; θ′). From equation (11.10),we then know that this new parameter is guaranteed to produce a larger valueof the likelihood.

Page 230: Model Based Image Processing (Text)

220 The Expectation-Maximization (EM) Algorithm

With this understanding in mind, we can now state the two-step recursionthat defines the EM algorithm.

E-step: Q(θ; θ(k)) = E

[

log p(y,X|θ)|Y = y, θ(k)]

(11.11)

M-step: θ(k+1) = argmaxθ∈Ω

Q(θ; θ(k)) (11.12)

Since each new value of the parameter θ(k) is selected to maximize the Qfunction, we know that this iteration will produce a monotone increasingsequence of log likelihood values, log p(y|θ(k+1)) ≥ log p(y|θ(k)).

To summarize the results of this section, we list out the major propertiesassociated with the EM algorithm below.

Property 11.1. Decomposition of likelihood - Let X and Y be random vectorswith joint density function p(x, y|θ) for θ ∈ Ω. Then we have that

log p(y|θ) = Q(θ; θ′) +H(θ; θ′)

where Q(θ; θ′) and H(θ; θ′) are given by equations (11.5) and (11.6).

The Q and H functions then have the following properties.

Property 11.2. Properties of Q and H functions - Let X and Y be randomvectors with joint density function p(x, y|θ) for θ ∈ Ω, and let the functionsQ and H be given by equations (11.5) and (11.6). Then

• Q(θ; θ′) is a surrogate function for the maximization of log p(y|θ).

• H(θ′; θ′) = minθ∈ΩH(θ; θ′)

11.4 EM for Gaussian Mixtures

Now that we have the basic tools of the EM algorithm, we can use themto estimate the parameters of the Gaussian mixture distribution introducedin Section 11.2. In order to calculate the Q function for this problem, wewill need a more suitable expression for the joint distribution of Yn and Xn.Recalling that the Gaussian mixture is parameterized by

θ = [π0, µ0, σ20, · · · , πM−1, µM−1, σ

2M−1] ,

Page 231: Model Based Image Processing (Text)

11.4 EM for Gaussian Mixtures 221

then it is easily verified that the following equalities holds

log p(yn, xn|θ) = log p(yn|µxn, σxn

)πxn

=M−1∑

m=0

δ(xn −m) log p(yn|µm, σm) + log πm ,

where p(yn|µm, σm) denotes a Gaussian density with mean µm and standarddeviation σm. Notice, that the delta function in the sum is only 1 whenxn = m, otherwise it is zero. Since the values of Yn and Xn are assumedindependent for different n, we know that

log p(y, x|θ) =N∑

n=1

log p(yn, xn|θ)

=N∑

n=1

M−1∑

m=0

δ(xn −m) log p(yn|µm, σm) + log πm .

Using this expression, we can now calculate the Q function.

Q(θ; θ′) = E[log p(y,X|θ)|Y = y, θ′]

= E

[

N∑

n=1

M−1∑

m=0

δ(Xn −m) log p(yn|µm, σm) + log πm∣

Y = y, θ′]

=N∑

n=1

M−1∑

m=0

E[δ(Xn −m)|Y = y, θ′] log p(yn|µm, σm) + log πm

=N∑

n=1

M−1∑

m=0

PXn=m|Y =y, θ′ log p(yn|µm, σm) + log πm

Now plugging in the explicit expression for the Gaussian distribution, we getthe final expression for the Q function.

Q(θ; θ′) =N∑

n=1

M−1∑

m=0

−12σ2

m

(yn−µm)2 − 1

2log(

2πσ2m

)

+ log πm

PXn=m|Y =y, θ′

The posterior conditional probability, PXn=m|Y =y, θ′, can be easilycomputed using Bayes rule. If we define the new notation that

f(m|yn, θ′) , PXn=m|Y =y, θ′ ,

Page 232: Model Based Image Processing (Text)

222 The Expectation-Maximization (EM) Algorithm

then this function is given by

f(m|yn, θ′) =

1√

2πσ′2mexp

− 1

2σ′2m(yn − µ′m)

2

π′m

M−1∑

j=0

1√

2πσ′2j

exp

− 1

2σ′2j(yn − µ′j)

2

π′j

.

While this expression for f(m|yn, θ′) may appear complex, it is quite simpleto compute numerically.

In order to calculate the associated M-step, we must maximize Q(θ; θ′)with respect to the parameter θ. This maximization procedure is much thesame as is required for ML estimation of parameters. So for example, µk andσk are calculated the same way as is used for the ML estimate of mean andvariance of a Gaussian random variable. This approach results in the finalEM update equations for this clustering problem.

N (k+1)m =

N∑

n=1

f(m|yn, θ(k)) (11.13)

π(k+1)m =

N(k+1)m

N(11.14)

µ(k+1)m =

1

N(k+1)m

N∑

n=1

ynf(m|yn, θ(k)) (11.15)

[

σ2m

](k+1)=

1

N(k+1)m

N∑

n=1

(

yn − µ(k+1)m

)2

f(m|yn, θ(k)) (11.16)

11.5 Algorithmic Implementation of EM Clustering

In order to better understand the EM algorithm, it is useful to take a closerlook at its algorithmic implementation. To do this, we will use the algorithmicnotation of pseudo code programming where θ is the variable that contains thecurrent value of the parameter. Also, let Pn,m be the program variable thatcontains the current value of the posterior probability PXn=m|Y =y, θ.

Using these variables, the E-step is computed by evaluating the following

Page 233: Model Based Image Processing (Text)

11.5 Algorithmic Implementation of EM Clustering 223

expression for all values of n and m.

E-step: Pn,m ←

1√

2πσ2m

exp

− 1

2σ2m

(yn − µm)2

πm

M−1∑

j=0

1√

2πσ2j

exp

− 1

2σ2j

(yn − µj)2

πj

Notice that ← indicates that the value is assigned to the program variablePn,m. Once this is computed, we can update the model parameters by eval-uating the following expressions for all values of m.

M-step: Nm ←N∑

n=1

Pn,m (11.17)

πm ← Nm

N(11.18)

µm ← 1

Nm

N∑

n=1

ynPn,m (11.19)

σ2m ← 1

Nm

N∑

n=1

(yn − µm)2 Pn,m (11.20)

In this form, the meaning of the EM algorithm starts to become more clearas shown in Figure 11.3. With each update, we use the current estimate of theparameter, θ, to compute the matrix Pn,m, the probability that Xn has labelm. These posterior probabilities are then used to assign each data point, Yn,to the associated M clusters. Since the assignment is soft, each data pointhas partial membership in each cluster.

Once the data points are assigned to the clusters, then the parametersof each cluster, [πm, µm, σ

2m], can be updated based on the weighted contri-

butions of each sample. This results in an updated value for the parameterθ. However, with this new parameter, we must compute new entries for thematrix Pn,m, and the iterative process repeats.

In fact, this is a generalization of the heuristic method described in thebeginning of the chapter, except the hard classification heuristic of (11.1) isreplaced with the soft classification of the posterior probability. So the E-step can be viewed as a form of soft classification of the data to the available

Page 234: Model Based Image Processing (Text)

224 The Expectation-Maximization (EM) Algorithm

yN

y1

y2

P1,0

P1,1

P2,1

P2,0

P1,M

−1

P2,M

−1

PN,0

PN,1

PN,M−1

Cluster M−1[πM−1, µM−1, σM−1]

[π1, µ1, σ1]

Cluster 1

Cluster 0[π0, µ0, σ0]

Figure 11.3: This figure illustrates the structure of the EM algorithm updates. In theE-step, the matrix Pn,m is computed which contains the posterior probability thatXn = m. The entries Pn,m represent the soft assignment of each sample, Yn, to acluster m. Armed with this inform, the parameters of each cluster, (πm, µm, σm),may be updated in the M-step.

categories, while the M-step can be viewed as ML parameter estimation giventhose soft classifications.

11.6 EM Convergence and Majorization

In this section, we provide some insight into the convergence properties ofthe EM algorithm. From Property 11.2, we know that Q(θ; θ′) is a surro-gate function for the maximization of the log likelihood. So we know thatthe iterations of the EM algorithm will produce a monotone non-decreasingsequence of log likelihoods.

However, this raises the question, does the EM algorithm actually convergeto the ML estimate of θ? It is difficult to give a simple and clear answer tothis question because in optimization (as in life) many things can go wrong.For example, the iterations can become trapped in a local maximum of thelikelihood that is not a global maximum. Even if the likelihood has no localmaximum, there are strange technical problems that can occur, so it is diffi-cult to make a simple statement about the convergence to the ML estimatethat is absolutely true under all conditions.

But with that said, as a practical matter, the EM algorithm generally

Page 235: Model Based Image Processing (Text)

11.6 EM Convergence and Majorization 225

does converge to a local maximum of the log likelihood in typical estima-tion problems. For interested readers, the two references [69, 54] provide amore detailed introduction to the theory of convergence for the EM algo-rithm. However, in order to give some intuition regarding the convergence,we present some simplified results to illustrate the methods of proof.

Define the function L(θ) = log p(y|θ), then we know that for each iterationof the EM algorithm

L(θ(k+1)) ≥ L(θ(k)) .

If the ML estimate exists, then for all k, we also know that L(θ(k)) ≤L(θML) < ∞. Therefore, the sequence L(θ(k)) must be a monotone increas-ing sequence that is bounded above, so it must therefore reach a limit whichwe denote by L∗ = limk→∞ L(θ(k)). However, even though the limit exists,proving that the value L∗ is the maximum of the likelihood estimate, or thatthe limk→∞ θ(k) exists is a much more difficult matter.

The following simplified theorem gives some insight into the convergenceof the EM algorithm. The basic result is that under normal conditions, theEM algorithm converges to a parameter value for which the gradient of thelikelihood is zero. Typically, this means that the EM algorithm converges toa local or global maximum of the likelihood function.

Theorem 11.6.1. Let θ(k) ∈ Ω be a sequence of parameter values generatedby the EM updates. Assume that a) Ω is a open set, b) the functions Q and H

are continuously differentiable on Ω2, c) limk→∞ θ(k) = θ∗ exists for θ∗ ∈ Ω.Then

∇ log p(y|θ∗) = 0 .

Proof. First, we know that by the nature of the M-step, the updated parame-ter value, θ(k+1), is a global, and therefore, local maximum of the Q function.This implies that

0 = ∇Q(θ; θ(k))∣

θ=θ(k+1)

= limk→∞∇Q(θ(k+1); θ(k))

= ∇Q(

limk→∞

θ(k+1), limk→∞

θ(k))

= ∇Q(θ∗; θ∗)

= ∇ log p(y|θ∗) ,

Page 236: Model Based Image Processing (Text)

226 The Expectation-Maximization (EM) Algorithm

where for the last equality is the result of Property 8.9.

The assumptions of this proof are a bit artificial, but the result serves toillustrate the basic concepts of convergence. In particular, assumption a) isused to ensure that the solution does not fall on the boundary of a closed setbecause, if this happened, the gradient would no longer need to be zero at aglobal maximum.

11.7 Simplified Methods for Deriving EM Updates

While the direct calculation of the Q function can be complicated, it is clearthat there is a general pattern to the result. For example, in the clusteringexample of Sections 11.4 and 11.5 the final EM update equations appear muchlike the conventional ML estimates, except that the means are weighted by theprobability that a sample is from the particular class. This pattern turns outto have an underlying explanation which can be used to make the derivationof the EM updates much simpler. In fact, it turns out that for all exponentialdistributions, the form of the EM update is quite simple.

In the following two sections, we derive and explain an easy method for de-termining the EM update equations for any exponential distribution. Armedwith this technique, you will be able to write down the EM algorithm formost common distributions, without any need to calculate the dreaded Qfunction.

11.7.1 Exponential Distributions and Sufficient Statistics

In order to make the EM algorithm more intuitive and simpler to derive, wefirst must take a bit of a detour to understand two very fundamental toolsof statistical estimation: sufficient statistics and exponential families.With these two very powerful tools in hand, we will be able to dramaticallysimplify the derivations for the EM algorithm updates; so let’s take the timeto understand these important concepts.

First, we say that T (Y ) ∈ Rk is a sufficient statistic for the family of

distributions, p(y|θ) for θ ∈ Ω, if the density functions can be written in

Page 237: Model Based Image Processing (Text)

11.7 Simplified Methods for Deriving EM Updates 227

the formp(y|θ) = h(y) g(T (y), θ) , (11.21)

where g(·, ·) and h(·) are any two functions.

Intuitively, the sufficient statistic, T (Y ), distills into a k-dimensional vec-tor all the information required to estimate the parameter θ from the dataY . In particular, the ML estimator of θ must be a function of the sufficientstatistic T (Y ). To see this, notice that

θML = argmaxθ∈Ω

log p(y|θ)= argmax

θ∈Ωlog h(y) + log g(T (y), θ)

= argmaxθ∈Ω

log g(T (y), θ)

= f(T (y)) ,

for some function f(·).

Example 11.1. To illustrate the concept of a sufficient statistic, let us considerthe simple example of a set of i.i.d. Gaussian random variables, YiNi=1,with distribution N(µ, σ2). For this family of distributions parameterized

by θ =[

µ, σ2]t, we know that the joint density can be written as

p(y|θ)

=1

(2πσ2)N/2exp

− 1

2σ2

N∑

i=1

(yi − µ)2

(11.22)

=1

(2πσ2)N/2exp

−S 1

2σ2+ b

µ

σ2− Nµ2

2σ2

, (11.23)

where S and b are defined by

b =N∑

i=1

yi (11.24)

S =N∑

i=1

y2i . (11.25)

In order to see that T (Y ) = [b, S]t is a sufficient statistic, we select the twofunctions g(·, ·) and h(·) from equation (11.21) to be

h(y) = 1

Page 238: Model Based Image Processing (Text)

228 The Expectation-Maximization (EM) Algorithm

g

([

bS

]

,

[

µσ2

])

=1

(2πσ2)N/2exp

−S 1

2σ2+ b

µ

σ2− Nµ2

2σ2

.

In practice, we know that we do not need all the data in Y to estimate µ andσ. For example, we can compute the ML estimator of these parameters fromthe sufficient statistics b and S as follows.

µ =b

N

σ2 =S

N−(

b

N

)2

,

Many commonly used distributions, such as Gaussian, exponential, Pois-son, Bernoulli, and binomial, have a structure which makes them particularlyuseful. These distributions are known as exponential families because theirdensity can be written in a particularly useful exponential form. Below wegive the formal definition of an exponential family of distributions.

Definition 13. Exponential FamilyA family of density functions p(y|θ) for y ∈ R

N and θ ∈ Ω is saidto be a k-parameter exponential family if there exist functionsη(θ) ∈ R

k, s(y), d(θ) and statistic T (y) ∈ Rk such that

p(y|θ) = exp 〈η(θ), T (y)〉+ d(θ) + s(y) (11.26)

for all y ∈ RN and θ ∈ Ω where < ·, · > denotes an inner product. We

refer to T (y) as the natural sufficient statistic or natural statisticfor the exponential distribution.

Exponential families are extremely valuable because the log of their as-sociated density functions form an inner product that is easily manipulatedwhen computing ML parameter estimates. In general, ML estimates for ex-ponential families have the form

θML = argmaxθ∈Ω

log p(y|θ)= argmax

θ∈Ω〈η(θ), T (y)〉+ d(θ)

= f(T (y)) ,

for some function f(·).

Page 239: Model Based Image Processing (Text)

11.7 Simplified Methods for Deriving EM Updates 229

Referring back to the Example 11.1, we can see that the i.i.d. Gaussiandistribution of equation (11.22) is an example of an exponential family withnatural sufficient statistic T (y) = [b, S]t where b and S are defined in equa-tions (11.24) and (11.25). More specifically, if we define

η(θ) =

[ µσ2

− 12σ2

]

d(θ) = −N2

µ2

σ2+ log(2πσ2)

,

then the probability density of equation (11.22) has the form

p(y|θ) = exp

ηt(θ)T (Y ) + d(θ)

,

which means that it is an exponential family of densities parameterized byθ =

[

µ, σ2]t

with natural sufficient statistic T (Y ) = [b, S]t.

Below we present some examples of other important exponential families,and for each family we derive the natural sufficient statistic, T (Y ).

Example 11.2. Let YnNn=1 be i.i.d. random vectors of dimension p with multi-variate Gaussian distribution N(µ,R) and parameter θ = [µ,R]. Then p(y|θ)is an exponential distribution with natural sufficient statistics

b =N∑

n=1

yn

S =N∑

n=1

ynytn .

To see why this is true, we can use the result of equation (2.6) to write thedensity function for Y as

p(y|θ) = 1

(2π)Np/2|R|−N/2 exp

−12

(

tr

SR−1

− 2btR−1µ+NµtR−1µ)

.

which has the form of (11.26) required by a natural sufficient statistic of thedistribution. From these sufficient statistics, we can also compute the MLestimate, θ = [µ, R], as

µ = b/N

R = (S/N)− µµt .

Page 240: Model Based Image Processing (Text)

230 The Expectation-Maximization (EM) Algorithm

Of course, i.i.d. Gaussian random variables are just a special case of thisexample when the vector dimension is p = 1.

Example 11.3. Let XnN−1n=0 be i.i.d. random variables which take on the dis-crete values in the set 0, · · · ,M−1. The distribution ofXn is parameterizedby θ = [π0, · · · , πM−1] where PXn = i = πi. Then p(x|θ) is an exponentialdistribution with natural sufficient statistics

Nm =N∑

n=1

δ(Xn −m) .

To see why this is true, we can write the density function as

p(x|θ) =M−1∏

m=0

πNmm

because Nm counts the number of times Xn takes on the value m. This canthen be rewritten as

p(x|θ) = exp

M−1∑

m=0

Nm log πm

,

which has the form of (11.26) required by a natural sufficient statistic of thedistribution. Again, from these sufficient statistics we can compute the MLestimate, θ = [π0, · · · , πM−1], as

πm =Nm

N.

Example 11.4. Here we consider two random processes, Yn and Xn, with astructure similar to those used in the clustering problem of Sections 11.4 and11.5, except we generalize the problem slightly by assuming that each Yn isa p-dimensional multivariate Gaussian random vector when conditioned oneach Xn. Furthermore, assume the conditional distribution of each Yn given

Page 241: Model Based Image Processing (Text)

11.7 Simplified Methods for Deriving EM Updates 231

each Xn is Gaussian with conditional mean µm and conditional covarianceRm where m = Xn.

More specifically, we have that

p(y|x) =N∏

n=1

1

(2π)p/2|Rxn|−

12 exp

−12(yn − µxn

)tRxn(yn − µxn

)

were y and x represent the entire sequence of N random vectors and N

random variables.

Then in this case, p(y, x|θ) is an exponential distribution with naturalsufficient statistics given by

Nm =N∑

n=1

δ(xn −m) (11.27)

bm =N∑

n=1

ynδ(xn −m) (11.28)

Sm =N∑

n=1

ynytnδ(xn −m) . (11.29)

The ML parameter estimate, θ, can then be computed from these sufficientstatistics as

πm =Nm

N(11.30)

µm =bmNm

(11.31)

Rm =Sm

Nm− bmb

tm

N 2m

. (11.32)

The proof of these facts is left as an exercise. (See problem 4)

Of course the problem with the ML estimates of (11.30), (11.31), and(11.32) is that we may not know the labels Xn. This is the incomplete dataproblem that the EM algorithm addresses. In the next section, we will see howthe EM algorithm can be easily applied for any such exponential distribution.

Page 242: Model Based Image Processing (Text)

232 The Expectation-Maximization (EM) Algorithm

11.7.2 EM for Exponential Distributions

Now that we have the tools of exponential families firmly in hand, we canuse them to simplify the derivation of the EM update equations. To dothis, we will make the assumption that the joint distribution of (X, Y ) comesfrom an exponential family, where Y is the observed or incomplete data, Xis the unobserved data, and θ is the parameter to be estimated by the EMalgorithm.

More specifically, let the distribution of (X, Y ) be from an exponentialfamily parameterized by θ, then we know that

p(y, x|θ) = exp〈g(θ), T (y, x)〉+ d(θ) + s(y, x)

for some natural sufficient statistic T (y, x). Assuming the ML estimate of θexists, then it is given by

θML = argmaxθ∈Ω〈g(θ), T (y, x)〉+ d(θ)

= f(T (y, x)) (11.33)

where f(·) is some function of T (y, x).

Recalling the form of the Q function, we have

Q(θ; θ′) = E[log p(y,X|θ)|Y = y, θ′] ,

where Y is the observed data and X is the unknown data. Using the assumedstructure of the exponential distribution, we have that

Q(θ; θ′) = E[log p(y,X|θ)|Y = y, θ′]

= E[〈g(θ), T (y,X)〉+ d(θ) + s(y,X)|Y = y, θ′]

=⟨

g(θ), T (y)⟩

+ d(θ) + constant ,

whereT (y) = E[T (y,X)|Y = y, θ′] ,

is the conditional expectation of the sufficient statistic T (y,X), and “constant”is a constant which does not depend on θ. Since our objective is to maximizeQ with respect to θ, this constant can be dropped. A single update of theEM algorithm is then given by the recursion

θ′′ = argmaxθ∈Ω

Q(θ; θ′)

Page 243: Model Based Image Processing (Text)

11.7 Simplified Methods for Deriving EM Updates 233

= argmaxθ∈Ω

g(θ), T (y)⟩

+ d(θ)

= f(T (y)) . (11.34)

Intuitively, we see that the EM update of (11.34) has the same form as thecomputation of the ML estimate in equation (11.33), but with the expectedvalue of the statistic, T , replacing the actual statistic, T .

11.7.3 EM for Multivariate Gaussian Mixtures

To see how useful the result of the previous Section 11.7.2 can be, we applyit to extend the clustering example of Sections 11.4 and 11.5 to the problemof EM estimation for multivariate Gaussian mixture distributions. So in thiscase, each observation Yn ∈ R

p is a p-dimensional vector that is conditionallyGaussian given the unknown class, Xn ∈ 0, · · · ,M − 1.

Example 11.5. Let Yn and Xn be as in the previous Example 11.4 in thischapter. So YnNn=1 are p-dimensional conditionally independent Gaussianrandom vectors given the class labels XnNn=1 with conditional mean andcovariance given by µm and Rm when Xn = m; and Xn are assumed i.i.d.with PXn = m = πm for 0 ≤ m < M − 1.

Then we know from Example 11.4 that p(y, x|θ) is an exponential distri-bution with parameter

θ = (π0, µ0, R0, · · · , πM−1, µM−1, RM−1)

and natural sufficient statistics given by equations (11.27), (11.28), and (11.29).

In order to derive the EM update, we only need to replace the sufficientstatistics in the ML estimate by their expected values. So to compute the EMupdate of the parameter θ, we first must compute the conditional expectationof the sufficient statistics. We can do this for the statistic Nm as follows.

Nm = E

[

Nm|Y = y, θ(k)]

= E

[

N∑

n=1

δ(xn −m)

Y = y, θ(k)

]

=N∑

n=1

E

[

δ(xn −m)|Y = y, θ(k)]

Page 244: Model Based Image Processing (Text)

234 The Expectation-Maximization (EM) Algorithm

=N∑

n=1

PXn = m|Y = y, θ(k)

Using a similar approach for all three sufficient statistics yields the E-step of

Nm =N∑

n=1

PXn = m|Y = y, θ(k)

bm =N∑

n=1

ynPXn = m|Y = y, θ(k)

Sm =N∑

n=1

ynytnPXn = m|Y = y, θ(k) .

Then in order to calculate the M-step, we simply use these expected statisticsin place of the conventional statistics in the equations for the ML estimator.

π(k+1)m =

Nm

N

µ(k+1)m =

bmNm

R(k+1)m =

Sm

Nm− bmb

tm

N 2m

.

With each repetition of this process, we increase the likelihood of the obser-vations. Assuming that the likelihood has a maximum1 and that one is nottrapped in a local maximum, then repeated application of the EM iterationswill converge to the ML estimate of θ.

11.8 ***Cluster Order Selection

Need to add a section on this. Use some of the writeup from the Clustersoftware manual.

1 For the case of a Gaussian mixture with no lower bound on the eigenvalues of R(k)m , the likelihood is

not bounded. However, in practice a local maximum of the likelihood usually provides a good estimate ofthe parameters.

Page 245: Model Based Image Processing (Text)

11.9 Chapter Problems 235

11.9 Chapter Problems

1. Let Y and X be random objects with non-negative density function2

p(y|θ) for θ ∈ Ω. Then derive the following relationships that form thebasis of the EM algorithm.

a) Show that for all parameter values θ, θ′ ∈ Ω,

log p(y|θ) = Q(θ; θ′) +H(θ; θ′)

where the functions Q and H are defined as

Q(θ; θ′) = E[log p(y,X|θ)|Y = y, θ′] (11.35)

H(θ; θ′) = −E[log p(X|y, θ)|Y = y, θ′] . (11.36)

b) Show that for all parameter values θ, θ′ ∈ Ω

H(θ; θ′) ≥ H(θ′; θ′)

c) Show that for all parameter values θ, θ′ ∈ Ω

log p(y|θ)− log p(y|θ′) ≥ Q(θ; θ′)−Q(θ′; θ′) .

2. Use the Q function in Section 11.4 to calculate the solutions to the M-step shown in equations (11.14), (11.15), and (11.16).

3. Derive the expression for the multivariate Gaussian density of p(y|θ)given in Example 11.2 with the following form.

p(y|θ) = 1

(2π)Np/2|R|−N/2 exp

−12

(

tr

SR−1

− 2btR−1µ+NµtR−1µ)

.

4. Show that the result stated in Example 11.4 is correct.

5. Let X and Y be two random vectors of dimensions N and p respectivelythat are jointly distributed with a Gaussian mixture. More specifically,

the column vector Z =

[

XY

]

has mixture density given by

p(z) =M−1∑

i=0

πif(z|µi, Bi)

2 More generally, this can also be a probability mass function or a mixed probability density/massfunction.

Page 246: Model Based Image Processing (Text)

236 The Expectation-Maximization (EM) Algorithm

where f(z|µ,B) is general notation for an N dimensional multivariateGaussian density with mean µ ∈ R

N and inverse covariance B ∈ RN×N

given by

f(z|µ,B) =1

(2π)N/2|B|1/2 exp

−12(z − µ)tB(z − µ)

.

Furthermore, assume that Bi has a block structure with the form

Bi =

[

Bxx,i Bxy,i

Btxy,i Byy,i

]

,

where Bxx,i is N ×N , Bxy,i is N × p, and Byy,i is p× p.

a) Show that the distribution of X is a Gaussian mixture.

b) Show that the conditional distribution of X given Y is a Gaussianmixture with the form

p(x|y) =M−1∑

i=0

πi(y)f(x|µi(y), Bxx,i) ,

and find expressions for its parameters µi(y) and πi(y).

c) Use the result of b) above to find an expression for the function g(y)so that

E[X|Y ] = g(Y ) .

d) Is g(Y ) a linear function of Y ? Why or why not?

6. Let Xn be N i.i.d. random variables with PXn = i = πi for i =0, · · · ,M − 1. Also, assume that Yn ∈ R

p are conditionally independentGaussian random vectors given Xn and that the conditional distributionof Yn given Xn is distributed as N(µxn

, γxn). Derive an EM algorithm for

estimating the parameters πi, µi, γiM−1i=0 from the observations YnNn=1.

7. Let Xn, Wn, and Yn each be i.i.d. discrete time random processes with

Yn = Xn +Wn

where Xn ∼ N(µ,R) and Wn ∼ N(0, I).

Page 247: Model Based Image Processing (Text)

11.9 Chapter Problems 237

a) Show that given N realizations, X1, X2, · · · , XN , the ML estimates ofR and µ are

µ =1

N

N∑

n=1

Xn

and

R =1

N

N∑

n=1

(Xn − µ)(Xn − µ)t .

b) Derive the EM algorithm for computing the ML estimates of R andµ from YnNn=1.

8. Let Xn be a sequence of i.i.d. random variables for n = 1, · · · , N , and letYn be a sequence of random variables that are conditionally independentand exponentially distributed with mean µi for i = 0, · · · ,M − 1 giventhe corresponding values of Xn. More specifically, the distributions ofX and Y are given by

PXn = i = πi

p(yn|xn) =1

µxn

e−yn/µxnu(yn)

where i ∈ 0, · · · ,M − 1 and u(·) is the unit step function. Further-more, let θ = [π0, µ0, · · · , πM−1, µM−1] be the parameter vector of thedistribution.

a) Derive a closed form expression for the ML estimate of θ given bothX and Y (i.e., the complete data).

b) Find the natural sufficient statistics for the exponential distributionof (X, Y ).

c) Use the results of this chapter to derive the EM algorithm for com-puting the ML estimate of θ from Y .

9. Let XnNn=1 be a i.i.d. random varibles with distribution

PXn = m = πm ,

where∑M−1

m=0 πm = 1. Also, let Yn be conditionally independent randomvariables given Xn, with Poisson conditional distribution

p(yn|xn = m) =λynm e−λm

yn!.

Page 248: Model Based Image Processing (Text)

238 The Expectation-Maximization (EM) Algorithm

a) Write out the density function for the vector Y .

b) What are the natural sufficient statistics for the complete data (X, Y )?

c) Give an expression for the ML estimate of the parameter

θ = (π0, λ0, · · · , πM−1, λM−1) ,

given the complete data (X, Y ).

d) Give the EM update equations for computing the ML estimate of theparameter θ = (π0, λ0, · · · , πM−1, λM−1) given the incomplete data Y .

Page 249: Model Based Image Processing (Text)

Chapter 12

Markov Chains and Hidden MarkovModels

In this chapter, we will introduce the concept of Markov chains and showhow Markov chains can be used to model signals using structures such ashidden Markov models (HMM). Markov chains represent data as a sequenceof states in time, and they are based on the simple idea that each new stateis only dependent on the previous state. This simple assumption makes themeasy to analyze, but still allows them to be very powerful tools for modelinga wide variety of physical processes.

We finish the chapter by discussing what happens to the states of a ho-mogeneous Markov chain as time tends towards infinity. Once the transientbehavior decays, one would expect that a homogeneous Markov chain shouldreach steady state. When this does happen, we call the Markov chain ergodic,and we will present some simple technical conditions that ensure ergodicity.In fact, we will see that ergodic Markov chains are very useful in a widerange of applications and are particularly important in applications such asMonte Carlo simulation, generating a stochastic sample of a Markov ran-dom field, and stochastic optimization. This issue of stochastic sampling andoptimization will be considered in more detail in Chapter 14.

12.1 Markov Chains

It is often useful to model the discrete state of a real-world system as it evolvesin time. So for example, the discrete-time random process, XnNn=0, which

Page 250: Model Based Image Processing (Text)

240 Markov Chains and Hidden Markov Models

takes values on a countable set, Ω, might be used to represent many things.For a speech signal, each state could represent the particular phoneme beingvoice; for music, it could represent the specific note of a discrete musical scale;and for a digitally modulated signal, it could represent the discrete binaryvalues 0 or 1.

While the behavior of physical systems can never be fully characterized bya stochastic model, it is often useful to approximate the distribution of eachnew state, Xn, as only dependent on the previous state, Xn−1. In this case,we call the random process a Markov chain. The following definition makesthis more precise.

Definition 14. Markov ChainLet Xn∞n=0 be a discrete-time random process taking values in thecountable set, Ω. Then we say that Xn is a Markov chain if for allj ∈ Ω and for all n > 0

PXn = j|Xk for all k < n = PXn = j|Xn−1 ,

where Ω is the state space of the Markov chain.

Since the state space is discrete and countable, we can assume, withoutloss of generality, that Ω = 0, · · · ,M−1, where M = ∞ is allowed. Wealso allow for the possibility that the Markov chain is of finite length, so thatthe Markov chain consists of the sequence X0, · · · , XN . In the case whereΩ is continuously valued, then we refer to Xn as a discrete-time Markovprocess. However, we will primarily focus on Markov chains because theyare easy to analyze and of great practical value. Nonetheless, most of theresults we derive are also true for discrete-time Markov processes.

In order to analyze a Markov chain, we need to first define some basicnotation. The marginal distribution, π

(n)j , and transition probabilities,

P(n)i,j , of the Markov chain are defined as

π(n)j

= PXn = j

P(n)i,j

= PXn = j|Xn−1 = i

for i, j ∈ Ω. If the transition probabilities, P(n)i,j , do not depend on time, n,

then we say that Xn is a homogeneous Markov chain. For the remainder

Page 251: Model Based Image Processing (Text)

12.1 Markov Chains 241

of this chapter, we will assume that Markov chains are homogeneous unlessotherwise stated.

One might initially guess that a homogeneous Markov chain will have astationary distribution; so that for example, its marginal distribution willnot vary with time. However, this is not true, since the Markov chain canhave transient behavior depending on the initial distribution of states atn = 0. Nonetheless, it is reasonable to expect that after a sufficient time, anytransient behavior would die out, and the Markov chain might reach sometype of steady-state behavior. In fact, Section 12.4 will treat this issue indetail.

From the parameters of the Markov process, we can derive an expressionfor the probability of the sequence XnNn=0. In order to simplify notation,denote the distribution of the initial state as

τj = π(0)j = PX0 = j .

Then the probability of a particular state sequence for the Markov chainis given by the product of the probability of the initial state, τx0

, with theprobabilities for each of the N transitions from state xn−1 to state xn. Thisproduct is given by

p(x) = τx0

N∏

n=1

Pxn−1,xn. (12.1)

From this expression, it is clear that the Markov chain is parameterized byits initial distribution, τj, and its transition probabilities, Pi,j.

Example 12.1. Let XnNn=0 be a Markov chain with state-space Ω = 0, 1and parameters given by

τj = 1/2

Pi,j =

1− ρ if j = iρ if j 6= i

.

This Markov chain starts with an equal chance of being 0 or 1. Then witheach new state, it has probability ρ of changing states, and probability 1− ρ

of remaining in the same state. If ρ is small, then the probability of changingstate is small, and the Markov chain is likely to stay in the same state for

Page 252: Model Based Image Processing (Text)

242 Markov Chains and Hidden Markov Models

10 20 30 40 50−0.5

0

0.5

1

1.5

Discrete Time, n

Sta

te V

alue

10 20 30 40 50−0.5

0

0.5

1

1.5

Discrete Time, n

Sta

te V

alue

10 20 30 40 50−0.5

0

0.5

1

1.5

Discrete Time, n

Sta

te V

alue

ρ = 0.01 ρ = 0.5 ρ = 0.9

Figure 12.1: Three figures illustrating three distinct behaviors of the Markov chainexample with ρ = 0.1, 0.5, and 0.9. In the case of ρ = 0.1, the Markov chain remainsin its current state 90% of the time. When ρ = 0.5, the state is independent of thepast with each new value; and when ρ = 0.9, the state changes value 90% of the time.

an extended period of time. When ρ = 1/2 each new state is independentof the previous state; and when ρ is approximately 1, then the state is likelyto change with each new value of n. These three cases are illustrated inFigure 12.1.

If we define the statistic

K = N −N∑

n=1

δ(Xn −Xn−1) ,

then K is the number of times that the Markov chain changes state. Usingthis definition, we can express the probability of the sequence as

p(x) = (1/2)(1− ρ)N−KρK .

12.2 Parameter Estimation for Markov Chains

Markov chains are very useful for modeling physical phenomena because,as with AR models, we simply predict the distribution of the next samplefrom the previous one. However, the challenge with Markov chains is oftento accurately estimate the parameters of the model from real data. If theMarkov chain is nonhomogeneous, then the number of parameters will growwith the length of the sequence. So it is often practically necessary to assume

Page 253: Model Based Image Processing (Text)

12.2 Parameter Estimation for Markov Chains 243

Markov chains are homogeneous. However, even when the Markov chain ishomogeneous, there are M 2 parameters to choose, where M = |Ω| is thenumber of states.1 Therefore, it is important to have effective methods toestimate these parameters.

Fortunately, we will see that Markov chains are exponential distributions,so parameters are easily estimated from natural sufficient statistics (See Sec-tion 11.7.1 for details). Let XnNn=0 be a Markov chain parameterized byθ = [τj, Pi,j : for i, j ∈ Ω], and define the statistics

Nj = δ(X0 − j)

Ki,j =N∑

n=1

δ(Xn − j)δ(Xn−1 − i) .

The statistic Ki,j essentially counts the number of times that the Markovchain transitions from state i to j, and the statistic Nj counts the number oftimes the initial state has value j. Using these statistics, we can express theprobability of the Markov chain sequence as

p(x) =

j∈ΩτNj

j

i∈Ω

j∈ΩP

Ki,j

i,j

,

which means that the log likelihood has the form2

log p(x) =∑

j∈Ω

Nj log(τj) +∑

i∈ΩKi,j log(Pi,j)

. (12.2)

Based on this, it is easy to see that the distribution of the Markov chainXn with parameter θ is from an exponential family, and that Ni and Ki,j

are its natural sufficient statistics. From (12.2), we can derive the maximumlikelihood estimates of the parameter θ in much the same manner as is donefor the ML estimates of the parameters of a Bernoulli sequence. This resultsin the ML estimates

τj = Nj (12.3)

1The quantity M2 results from the sum of M parameters for the initial state plus M(M − 1) parametersfor the transition probabilities. The value M(M − 1) results form the fact that there are M rows to thetransition matrix and each row has M − 1 degrees of freedom since it must sum to 1.

2This expression assumes that the parameters are non-zero, but the results for the ML parameter estimatesstill hold in the general case.

Page 254: Model Based Image Processing (Text)

244 Markov Chains and Hidden Markov Models

XN−1X0 X1 X2 XN

Y1 Y2 YN−1 YN

Figure 12.2: This diagram illustrates the dependency of quantities in a hidden Markovmodel. Notice that the values Xn form a Markov chain in time, while the observedvalues, Yn, are dependent on the corresponding labels Xn.

Pi,j =Ki,j

j∈ΩKi,j. (12.4)

So the ML estimate of transition parameters is quite reasonable. It simplycounts the rate at which a particular transition occurs from state i to state j,and then normalizes this quantity so it sums to 1 for each initial state i.

12.3 Hidden Markov Models

One important use of Markov chains is in hidden Markov models (HMM).Figure 12.2 shows the structure of an HMM. The discrete values XnNn=0

form a Markov chain in time, and their values determine the distribution ofthe corresponding observations YnNn=1. Much like in the case of the Gaus-sian mixture distribution, the labels Xn are typically not observed in the realapplication, but we can imagine that their existence explains the changesin behavior of Yn over long time scales. As with the example of the mix-ture distribution from Section 11.2, the HMM model is a doubly-stochasticmodel because the unobserved stochastic process Xn controls the observedstochastic process Yn.

HMMs are very useful in applications such as audio or speech processing.For these applications, the observations Yn are typically continuously valuedfeature vectors describing the local sound properties, and the discrete randomvariables, Xn, represent the underlying state of the audio signal. So forexample in speech applications, Xn might be a label that represents thespecific phoneme or sound that is being voiced in the pronunciation of aword.

In order to analyze the HMM, we start by defining some notation. Let the

Page 255: Model Based Image Processing (Text)

12.3 Hidden Markov Models 245

density function for Yn given Xn be given by

f(y|k) = PYn ∈ dy|Xn = k ,and let the Markov chain Xn be parameterized by θ = [τj, Pi,j : for i, j ∈ Ω],then the joint density function for the sequences Y and X is given by 3

p(y, x|θ) = τx0

N∏

n=1

f(yn|xn)Pxn−1,xn

.

and assuming that no quantities are zero, the log likelihood is given by

log p(y, x|θ) = log τx0+

N∑

n=1

log f(yn|xn) + logPxn−1,xn

.

There are two basic tasks which one typically needs to perform usingHMMs. The first task is to estimate the unknown states, Xn, from theobserved data, Yn, and the second task is to estimate the parameters, θ,from the observations, Yn. The following two sections explain how theseproblems can be solved using dynamic programing and the EM algorithm ofChapter 11.

12.3.1 State Sequence Estimation and Dynamic Programming

When using HMMs, it is often important to be able to estimate the unob-served discrete state sequence, X, from the full set of observations, Y . Thisproblem is known as state sequence estimation. While different estima-tors present different strengths and weaknesses, one commonly used estimatefor the state sequence is the MAP estimate given by

x = arg maxx∈ΩN

p(x|y, θ)= arg max

x∈ΩNlog p(y, x|θ) .

When we expand out the MAP optimization problem using the log likelihoodof the HMM, it is not obvious that it can be tractably solved.

x = arg maxx∈ΩN

log τx0+

N∑

n=1

log f(yn|xn) + logPxn−1,xn

(12.5)

3This is actually a mixed probability density and probability mass function. This is fine as long as oneremembers to integrate over y and sum over x.

Page 256: Model Based Image Processing (Text)

246 Markov Chains and Hidden Markov Models

PresentPast Future

Yn+1

X0 X1

Y1

Xn−1

Yn−1

Xn

Yn

XN

YN

Xn+1

Past Present FutureObservation y<n = y1, · · · , yn−1 yn y>n = yn+1, · · · , yN

State x<n = x0, · · · , xn−1 xn x>n = xn+1, · · · , xN

Figure 12.3: The figure and associated table illustrates the notation we will use to de-note the past, present, and future information in a HMM’s state, x, and observations,y. The boxes represent aggregated quantities corresponding to the past, present,or future, while the circles represent individual states or observations. The arrowsindicate conditional dependence in our assumed model.

On its face, the optimization of (12.5) is an extraordinarily difficult problem,requiring a search over a state space of the size MN+1. However, the prob-lem’s complexity can be dramatically reduced by decomposing it into com-ponents corresponding to the past, present, and future values of the statesand observations. Figure 12.3.1 provides a visual representation of how theseobservations and states are related along with a table defining some new no-tation for the problem. This notation will allow us to more compactly expressthe probabilities of past, present, and future events.

Using this new notation and the assumed dependencies of the HMM, wecan write the joint distribution of the observations and states as the followingproduct, (See problem 2)

p(y, x) = p(y>n, x>n|xn)f(yn|xn)p(y<n, xn, x<n) , (12.6)

where the conditional distributions have the following intuitive interpreta-tions.

p(y>n, x>n|xn) = P (Future|present state)f(yn|xn) = P (Present observation|present state)

p(y<n, xn, x<n) = P (Past along with present state)

Using this formulation of the problem, we may define a solution to the future

Page 257: Model Based Image Processing (Text)

12.3 Hidden Markov Models 247

portion of the problem given an assumed value for xn = j as the function

L(j, n) = maxx>n

log p(y>n, x>n|xn = j) .

So the function L(xn, n) specifies the maximum log probability of thefuture states and observations given that the present state at time n is knownto be xn. From this definition, we can work out the following recursiverelationship for L(i, n− 1) in terms of a maximization involving L(j, n).

L(i, n− 1) = maxj∈Ωlog f(yn|j) + logPi,j + L(j, n) (12.7)

The application of this recursion, along with the additional boundary con-straint that L(j,N) = 0, is a special case of a more general optimizationstrategy known as dynamic programming. Using this approach, the val-ues of L(i, n) can be computed for 0 ≤ n ≤ N and i ∈ Ω with order NM 2

computational complexity. The complexity result is due to the fact that foreach value of n and for each value of i, we must maximize over M possiblevalues of j.

Of course, the values of L(i, n) are not actually what we are needed. Whatwe need to know are the values of the states, xn, that maximize the likelihood.However, with the stored values of L(i, n) from the dynamic programingrecursion, we can easily compute the states using the following relationships.

x0 = argmaxj∈Ωlog τj + L(j, 0) (12.8)

xn = argmaxj∈Ω

logPxn−1,j + log f(yn|j) + L(j, n)

(12.9)

Figure 12.4 shows the complete algorithm for MAP sequence estimation.

12.3.2 State Probability and the Forward-Backward Algorithm

While the MAP estimate of the state sequence, xn, is useful, in some cases wemay need to know the actual distribution of individual states. In particular,we will need to know the joint distribution of pairs of states, (xn−1, xn), inorder to train HMM models later is Section 12.3.3.

In fact, we can use techniques very similar to those of Section 12.3.1 inorder to compute the marginal and joint distributions of states. Again, the

Page 258: Model Based Image Processing (Text)

248 Markov Chains and Hidden Markov Models

MAP Sequence Estimation:

For i ∈ Ω, L(i, N) = 0

For n = N to 1 For i ∈ Ω,

L(i, n− 1) = maxj∈Ω log f(yn|j) + logPi,j + L(j, n)

For i ∈ Ω, x0 = argmaxj∈Ω log τk + L(j, 0)For n = 1 to N

For i ∈ Ω,

xn = argmaxj∈Ω

logPxn−1,j + log f(yn|j) + L(j, n)

Figure 12.4: A pseudocode specification of the dynamic programing algorithm usedfor MAP state sequence estimation of HMMs.

trick is to break up the observation and state variables into their past, present,and future components. To do this, we define the following two functions.

αn(j) = p(xn = j, yn, y<n)

βn(j) = p(y>n|xn = j)

If we can compute these two functions, then the joint probability of theobservations and xn can be expressed simply as

p(xn = j, y) = αn(j)βn(j) , (12.10)

and from this it is easy to compute the conditional density of xn as,

p(xn = j|y) =αn(j)βn(j)

p(y), (12.11)

where p(y) is just a normalizing constant given by

p(y) =∑

j∈Ωαn(j)βn(j) =

j∈Ωα0(j)β0(j) . (12.12)

We can also compute the joint conditional density of (xn−1, xn) similarly as

p(xn−1 = i, xn = j|y) =αn−1(i)Pi,jf(yn|j)βn(j)

p(y), (12.13)

where again p(y) can be computed using equation (12.12).

Page 259: Model Based Image Processing (Text)

12.3 Hidden Markov Models 249

The efficient algorithm for computing the functions αn(j) and βn(j) isknown as the forward-backward algorithm. It takes its name from thefact that αn(j) is computed using a forward recursion, and βn(j) is computedusing a backward recursion. The overall flow of the forward-backward algo-rithm is very similar to that of the dynamic programing technique used inSection 12.3.1. The forward recursion is given by

αn(j) =∑

i∈Ωαn−1(i)Pi,j f(yn|j) , (12.14)

with a boundary condition of α0(j) = τj, and the backward recursion is givenby

βn(i) =∑

j∈ΩPi,jf(yn+1|j)βn+1(j) (12.15)

with a boundary condition of βN(i) = 1. Figure 12.5 gives a pseudocodesummary of the forward backward algorithm. Again, the total computationrequired for this algorithm is order NM 2 due to the requirement of computingthe functions for all n and i, and the sum of the index j.

12.3.3 Training HMMs with the EM Algorithm

Of course, HMMs are only useful if they accurately model the behavior ofreal physical processes. Since the HMM represents a generic model structure,it is necessary to fit the properties of a specific HMM model to some spe-cific physical process of interest. In practice, this fitting process is typicallyaccomplished by estimating the parameters of the HMM from some typicalexamples. Often, these examples sequences, known as training data, arecollected for the specific purpose of training the HMM model.

Ideally, the training data should consist of sequences of observations, Yn,along with the hidden states, Xn. This might be possible in cases where theexact states, Xn, can be measured at additional cost. However in many cases,the unknown states, Xn, may not be available at any cost. For example, inspeech modeling, Xn could represent the phoneme being voiced and Yn thespectral features of the auditory signal. In this example, there is no way todirectly measure the phoneme being voiced, so any training must estimate theparameters of the HMM model while simultaneously estimating the unknown

Page 260: Model Based Image Processing (Text)

250 Markov Chains and Hidden Markov Models

Forward-Backward Algorithm:

/* forward step */For j ∈ Ω, α0(j) = τj

For n = 1 to N For j ∈ Ω,

αn(j) =∑

i∈Ω αn−1(i)Pi,j f(yn|j)

/* backwards step */For i ∈ Ω, βN(i) = 1

For n = N to 1For i ∈ Ω,

βn(i) =∑

j∈Ω Pi,jf(yn+1|j)βn+1(j)

/* calculate probabilities */For n = 1 to N and i, j ∈ Ω,

p(y) =∑

i∈Ω

α0(i)β0(i)

PXn = i|Y = y, θ = αn(i)βn(i)

p(y)

PXn = j,Xn−1 = i|Y = y, θ = αn−1(i)Pi,j f(yn|j)βn(i)

p(y)

Figure 12.5: A pseudocode specification of the forward-backward algorithm requiredfor computing the marginal and conditional distributions of states in an HMM.

states, Xn. This problem of parameter estimation from incomplete data isa classic example for which EM the algorithm, as described Chapter 11, isperfectly suited.

In a typical application, the observed quantity Yn is an p dimensional mul-tivariate Gaussian random vector with conditional distribution N(µxn

, Rxn).

So the complete set of parameters for the HMM will be θ = [µj, Rj, τj, Pi,j :for i, j ∈ Ω]. In this case it can be shown that the joint distribution, p(x, y|θ),is an exponential distribution with natural sufficient statistics given by

bj =N∑

n=1

ynδ(xn − j) (12.16)

Sj =N∑

n=1

ynytnδ(xn − j) (12.17)

Page 261: Model Based Image Processing (Text)

12.3 Hidden Markov Models 251

Nj = δ(x0 − j) (12.18)

Ki,j =N∑

n=1

δ(xn − j)δ(xn−1 − i) , (12.19)

and another useful statistic, Kj, can be computed from these as

Kj =∑

i∈ΩKi,j =

N∑

n=1

δ(xn − j) .

Referring back to the ML estimates for multivariate Gaussian distributionsgiven in equations (2.8) and (2.9), and the ML estimate derived for Markovchains in equations (12.3) and (12.4), we can write down the ML estimate ofthe entire parameter vector, θ, given both X and Y . These are given by

µj =bjKj

Rj =Sj

Kj−

bj btj

K2j

τj = Nj

Pi,j =Ki,j

j∈ΩKi,j.

Remember, these are the closed form ML estimates that we compute whenwe can observe the states Xn directly. So in this case, the problem is notincomplete.

Now the results from Section 11.7 dramatically simplify our computationbecause they state that the EM update equations directly result from replac-ing the natural sufficient statistics of the complete data problem with theirexpected values. So to compute the EM update of the parameter θ, we firstcompute the conditional expectation of the sufficient statistics in the E-stepas

bj ←N∑

n=1

ynPXn = j|Y = y, θ

Sj ←N∑

n=1

ynytnPXn = j|Y = y, θ

Page 262: Model Based Image Processing (Text)

252 Markov Chains and Hidden Markov Models

Nj ← PX0 = j|Y = y, θ

Ki,j ←N∑

n=1

PXn = j,Xn−1 = i|Y = y, θ

Kj ←N∑

n=1

PXn = j|Y = y, θ .

Then the HMM model parameters, θ = [µj, Rj, τj, Pi,j : for i, j ∈ Ω], areupdated using the M-step

µj ←bjKj

Rj ←Sj

Kj−

bj btj

K2j

τj ← Nj

Pi,j ←Ki,j

j∈Ω Ki,j.

Notice that the E-step requires the computation of the posterior probabilityof Xn given Y . Fortunately, this may be easily computed using the forward-backward algorithm shown in Figure 12.5 of the previous section.

12.4 Stationary Distributions of Markov Chains

In addition to using Markov chains as models of data, they can also serve asa very powerful computational tool. For example, in Chapter 13 we will useMonte Carlo Markov chains techniques to generate samples from very generalposterior distributions. Similar methods can also be used to numericallycompute expectations/integrals or to solve optimization problems.

In order to provide a framework for these methods, we will first need tointroduce a theory of ergodic Markov chains [55]. The key concept in thistheory is that a well behaved Markov chain should eventually reach a stablestationary distribution after the transient behavior dies away. So we will needtools for both guaranteeing that such a steady state distribution is reached,and determining precisely what that steady state distribution is.

Page 263: Model Based Image Processing (Text)

12.4 Stationary Distributions of Markov Chains 253

Again, let Xn∞n=0 be a homogeneous Markov chain with marginal density

given by π(n)j = PXn = j and transitions probabilities given by Pi,j =

PXn = j|Xn−1 = i. Then a fundamental property of Markov chains is thatthe marginal probability density for time n+ 1 can be expressed as

π(n+1)j =

i∈Ωπ(n)i Pi,j . (12.20)

When the number of states is finite, then we can more compactly expressthese ideas using vector/matrix notation. To do this, let π(n) be a 1 ×M

row vector containing the marginal densities, and let P be an M ×M matrixcontaining the transition probabilities. Then in matrix notation, we havethat

π(n+1) = π(n)P . (12.21)

Repeated application of (12.21) results in the equation

π(n+m) = π(n)Pm , (12.22)

where Pm denotes the matrix raised to themth power. So we can compute themarginal distribution at any time in the future by repeated multiplication bythe transition matrix P . In particular, we can compute the marginal densityat any time n as

π(n) = π(0)P n .

Intuitively, we might expect that as n grows large, the Markov chain shouldreach some type of steady state. If that were to hold, then we must have thatlimn→∞ P n exists and that

π∞ = limn→∞

π(0)P n = π(0)P∞ .

Moreover, we might expect that the steady state behavior should not dependon the initial distribution, π(0). So if this holds, then we know two importantthings. First, each row of P∞ must equal π∞, so we have that

P∞ = 1π∞ ,

where 1 is an M × 1 vector of 1’s, and that π∞ must solve the equation

π∞ = π∞P . (12.23)

Page 264: Model Based Image Processing (Text)

254 Markov Chains and Hidden Markov Models

In fact, equation (12.23) also indicates that the matrix P has an eigenvalueof 1, with an associated eigenvector of π∞.

Unfortunately, it is not guaranteed that a homogeneous Markov chain willreach a steady state distribution that is invariant to the initial distribution.As a matter of fact, it is relatively easy to produce counterexamples, whichwe will do momentarily. Fortunately, the things that can go wrong can begrouped into three basic categories, and we can provide technical conditionsto guard against these cases.

The three basic counter examples to steady state behavior are:

• The density can become trapped in disconnected states;

• The density can become periodic;

• The density can disperse.

Below we present three corresponding counter examples illustrating each ofthese behaviors.

Example 12.2. In this example, we illustrate how a homogeneous Markovchain can fail to achieve a steady state distribution.

For the first case, let the Markov chain take values in the set −1, 1. LetXn+1 = Xn and let the initial distribution be given by π(0). In this case, it isobvious that the steady state distribution will always be given by

π∞i = limn→∞

PXn = i = π(0)i .

Therefore, the steady state distribution is not independent of the initial dis-tribution.

For the second case, let the Markov chain take values in the set −1, 1.Let X0 = 1, and let Xn+1 = −Xn. In this case, it can be easily shown that

PXn = 1 =

1 if n is even0 if n is odd

.

Therefore, the limn→∞ PXn = 1 does not exist.For the third case, let the Markov chain take on integer values. LetX0 = 0,

and let Xn+1 = Xn + Bn where Bn is an i.i.d. sequence of random variables

Page 265: Model Based Image Processing (Text)

12.4 Stationary Distributions of Markov Chains 255

with PBn = 1 = PBn = −1 = 1/2. In this case, it can be shown thatfor all integers i,

π∞i = limn→∞

PXn = i = 0 .

Therefore, the density function disperses to zero.

So if such simple examples of homogeneous Markov chains can result incounter examples, how can we ensure convergence to a steady state? Ofcourse, this is a huge field of research and many results exist, but we willprovide some simple conditions, that when satisfied, ensure ergodic behaviorof the Markov chain. We start with two definitions, which we will use toguard against disconnected states.

Definition 15. Communicating statesThe states i, j ∈ Ω of a discrete time discrete state homogeneous Markovchain are said to communicate if there exist integers n > 0 and m > 0 suchthat P n

i,j > 0 and Pmj,i > 0.

Intuitively, two states communicate if it is possible to transition betweenthe two states. It is easily shown that communication is an equivalenceproperty, so it partitions the set of states into disjoint subsets, and onlystates within a subset communicate with each other. This leads to a naturaldefinition for irreducible Markov chains.

Definition 16. Irreducible Markov ChainA discrete time discrete state homogeneous Markov chain is said to be irre-ducible if for all i, j ∈ Ω, i and j communicate.

So a Markov chain is irreducible if it is possible to change from any initialstate to any other state in finite time.

The next condition is used to guard against periodic repetition of statesthat can last indefinitely and will not allow convergence to steady state.

Definition 17. Periodic stateWe denote the period of a state i ∈ Ω by the value d(i) where d(i) is the largestinteger so that [P n]i,i = 0 whenever n is not divisible by d(i). If d(i) > 1,then we say that the state i is periodic.

Page 266: Model Based Image Processing (Text)

256 Markov Chains and Hidden Markov Models

It can be shown that states of a Markov chain that communicate musthave the same period. Therefore, all the states of an irreducible Markovchain must have the same period. We say that an irreducible Markov chainis aperiodic if all the states have period 1.

Using these definitions, we may now state a theorem which gives basicconditions for convergence of the distribution of the Markov chain.

Theorem 12.4.1. Limit Theorem for Markov ChainsLet Xn ∈ Ω be a discrete-state discrete-time homogeneous Markov chain withtransition probabilities Pi,j and the following additional properties

• Ω is a finite set

• The Markov chain is irreducible

• The Markov chain is aperiodic

Then there exists a unique stationary distribution π, which for all states i isgiven by

πj = limn→∞

[P n]i,j > 0 , (12.24)

and which is the unique solution to the following set of equations.

1 =∑

i∈Ωπi (12.25)

πj =∑

i∈ΩπiPi,j (12.26)

The relations of (12.26) are called the full-balance equations. Anyprobability density which solves the full-balance equations is guaranteed tobe the stationary distribution of the Markov chain. Furthermore, in the limitas n → ∞, the Markov chain is guaranteed to converge to this stationarydistribution independently of the initial state. Markov chains that have thisproperty of (12.24) are said to be ergodic. It can be shown that for er-godic Markov chains, expectations of state variables can be replaced by timeaverages, which will be very useful in later sections.

Page 267: Model Based Image Processing (Text)

12.5 Properties of Markov Chains 257

12.5 Properties of Markov Chains

Theorem 12.4.1 provides relatively simple conditions to establish that a Markovchain has a stationary distribution. However, while it may be known that astationary distribution exists, it may be very difficult to compute the solutionof the full-balance equations in order to determine the precise form of thatdistribution. Fortunately, Markov chains have a variety of properties thatcan be extremely useful in both quantifying and understanding their conver-gence. The following section presents a sampling of some of the most usefulproperties.

First we derive some basic properties of Markov chains. Our first propertyis that the conditional distribution of Xn given some past set of samples, Xr

for r < k, is only dependent on the most recent sample, Xk. Stated formally,we have the following.

Property 12.1. Conditioning on past of a Markov Chain - Let Xn∞n=0 be aMarkov chain taking values on Ω, and let k < n be two integers. Then

PXn = xn|Xr r ≤ k = PXn = xn|Xk .

Intuitively, the present sample is only dependent on the most recent samplethat is available in the Markov chain.

This property can be used recursively to show that any subsampling ofa Markov chain must also be a Markov chain. So for example, if Yn = Xdn

where d is a positive integer, then we have that

PYn = yn|Yr r < n = PXdn = xdn|Xdr r < n= E[PXdn = xdn|Xr r ≤ d(n− 1)|Xdr r < n]

= E[

PXdn = xdn|Xd(n−1)|Xdr r < n]

= PXdn = xdn|Xd(n−1)= PYn = yn|Yn−1 ,

where the second equality uses the filtration property listed in Property 2.3,the third equality uses Property 12.1 above, and the forth equality uses theresult of equation (2.2).

This leads to our next property of Markov chains.

Page 268: Model Based Image Processing (Text)

258 Markov Chains and Hidden Markov Models

Property 12.2. Subsampling of a Markov chain - Let Xn∞n=0 be a Markovchain taking values on Ω, and let Yn = Xdn where d is a positive integer.Then Yn is a Markov chain. Furthermore, if Xn is a homogeneous Markovchain, then Yn is also a homogeneous Markov chain.

Perhaps surprisingly, it turns out that the concepts of reversibility areoften extremely useful in determining the stationary distributions of ergodicMarkov chains. So we will need to derive some important conditions relatedto reversible Markov chains.

Our first observation is that the time-reverse of any Markov chain resultsin another process with the Markov property.

Property 12.3. Time reverse of a Markov chain - Let XnNn=0 be a Markovchain taking values on Ω, and let Yn = XN−n for n = 0, · · · , N . Then Yn is aMarkov chain.

Perhaps the result of Property 12.3 is surprising given the causal definition ofa Markov chain. But in fact, there is hidden symmetry in the definition thatarrises through the ability to reverse conditional dependence using Bayes’rule.

It turns out that Property 12.3 provides a powerful tool for us to analyzethe convergence of a class of Markov chains. In order to see this, consider thecase when Xn is a homogeneous Markov chain which is in steady state withthe stationary distribution π. In general, we can write the joint distributionof (Xn, Xn−1) as

PXn = j,Xn−1 = i = PXn = j|Xn−1 = iPXn−1 = i= PXn−1 = i|Xn = jPXn = j .

So using this equality, and the definitions of πi and Pi,j, we have that

πiPi,j = PXn−1 = i|Xn = jπj . (12.27)

Now we know that the time-reversed process is also a Markov chain, so letits transition probabilities be denoted by

Qj,i , PXn−1 = i|Xn = j .Also notice that from the form of equation (12.27), Qj,i is not a function ofn, so the time-reversed Markov chain must also be homogeneous. Plugging

Page 269: Model Based Image Processing (Text)

12.5 Properties of Markov Chains 259

back into equation (12.27), we get an expression which must hold for anyhomogeneous Markov chain in steady state.

πiPi,j = πjQj,i . (12.28)

Now, if in addition, the Markov chain is reversible, then we know that thetransitions probabilities of the process running forward in time must be thesame as the transition probabilities running backwards in time. Formally,this means that Pi,j = Qi,j. Substituting this equality into equation (12.28)yields the so-called detailed-balance equations.

πiPi,j = πjPj,i (12.29)

The detailed-balance equations specify that the rate of transitions from statei to state j equals the rate of transitions from state j to i. This is always thecase when a Markov chain is reversible and in steady state. This result leadsto the following very important definition that extends to both homogeneousand nonhomogeneous Markov chains.

Definition 18. Reversible Markov ChainA Markov chain with transition probabilities PXn = j|Xn−1 = i is saidto be reversible under the stationary distribution πi if the following detailed-balance equations hold.

PXn = j|Xn−1 = iπi = PXn = i|Xn−1 = jπj (12.30)

It is not always possible to find a probability density πi which is a so-lution to the detailed-balance equations because not all Markov chains arereversible. But when you can find a solution, then that solution must alsobe a solution to the full-balance equations, which means that this is thestationary distribution of an ergodic Markov chain!

To see why this is true, we simply sum the detailed-balance equations overthe index i.

i∈ΩPXn = j|Xn−1 = iπi =

i∈ΩPXn = i|Xn−1 = jπj

= πj∑

i∈ΩPXn = i|Xn−1 = j

= πj

Page 270: Model Based Image Processing (Text)

260 Markov Chains and Hidden Markov Models

Example 12.3. A birth-death process is a classic example of a reversibleMarkov chain. In a birth-death process the state of the Markov chain, Xn,takes on values in the set 0, 1, 2, · · ·. With each new time increment, thevalue of Xn is either incremented (i.e., birth occurs), decremented (i.e., deathoccurs), or the state remains unchanged. Mathematically, this can be ex-pressed with the following transition probabilities.

Pi,j =

λ if j = i+ 1µ if j = i− 1 and i > 01− λ− µ if j = i and i > 01− λ if j = i and i = 00 otherwise

Here 0 < λ < 1 is the probability of a birth and 0 < µ < 1 is the probabilityof a death, where we also assume that λ+ µ < 1.

In this case, the detailed balance equations have a simple solution. Let πibe the steady-state probability that the Markov chain is in state i. Then thedetailed balance equations require that

πiλ = πi+1µ ,

for all i ≥ 0. This relations implies the recursion that πi+1 =λµπi must hold;

so we know that the solution must have the form

πi =1

z

(

λ

µ

)i

,

where z is a normalizing constant. When λµ < 1, then the value of z may

then be calculated as

z =∞∑

i=0

(

λ

µ

)i

=1

1− λµ

.

So the stationary distribution is given by

πi =

(

λ

µ

)i(

1− λ

µ

)

. (12.31)

Since the distribution of equation (12.31) solves the detailed balance equa-tions, it must also solve the full balance equations. This implies that it isa stationary distribution of the Markov chain, and that the Markov chain is

Page 271: Model Based Image Processing (Text)

12.5 Properties of Markov Chains 261

ergodic and reversible. However, when λµ ≥ 1, then the only solution to the

detailed balance equations has the form πi = 0. In this case, the Markovchain is not ergodic, which is to say that it does not reach a steady state.Intuitively, when λ ≥ µ, then the rate of births is greater than the rate ofdeaths, and the state grows toward infinity, so it can not reach a steady state.

Finally, it is useful to study the convergence behavior of Markov chainswith a finite number of states. In this case, the transition probabilities, Pi,j,can be represented by an M ×M matrix, P . In order to further simplify theanalysis, let us also assume that the eigenvalues of P are all distinct.4 In thiscase, P may be diagonalized using eigen decomposition and expressed in theform

P = E−1ΛE

where the rows of E are the left hand eigenvectors of P , and Λ is a diagonalmatrix of eigenvalues. Using this decomposition, we can see that

P n = P n−2E−1ΛE E−1ΛE

= P n−2E−1Λ2E

= E−1ΛnE .

So the distribution at time n is given by

π(n) = π(0)E−1ΛnE .

Then we can write this in terms of its modal components as

π(n) =M−1∑

m=0

cmΛnm,mEm,∗ ,

where Em,∗ is the mth row of E, and cm is the mth component of a constantvector given by c = π(0)E−1. When P corresponds to an irreducible andaperiodic Markov chain, then it must have a stationary distribution. In thiscase, exactly one of the eigenvalues is 1, and the remaining eigenvalues havemagnitude strictly less then 1. In this form, we can see that all the othermodes with eigenvalues |Λm,m| < 1 must decay away at a geometric rate. So,in principle, convergence of the Markov chain to its stationary distributionshould be rapid.

4The more general case is also tractable but it requires the use of the Jordan canonical form to handlemultiplicity in eigenvalues and their associated generalized eigenvectors.

Page 272: Model Based Image Processing (Text)

262 Markov Chains and Hidden Markov Models

12.6 Chapter Problems

1. Let XiNi=0 be a Markov Chain with Xi ∈ 0, · · · ,M−1 and transitionprobabilities given by PXn = j|Xn−1 = i = Pi,j where 0 ≤ i, j < M ,and initial probability PX0 = j = τj and parameters θ = (τ, P ). Alsodefine the statistics

Nj = δ(X0 − j)

Ki,j =N∑

n=1

δ(Xn − j)δ(Xn−1 − i) .

a) Use these statistics to derive an expression for the probability p(x).

b) Show that the Markov chain has an exponential distribution, and thatNj and Ki,j are the natural sufficient statistics of the distribution.

c) Derive the ML estimate of the parameters τj and Pi,j in terms of thenatural sufficient statistics.

2. Use the assumed properties of the HMM to prove the equality of equa-tion (12.6).

3. Show that the recursions of equations (12.7), (12.8), and (12.9) are cor-rect.

4. Use the definitions of αn(i) and βn(i) to derive the relationships of equa-tions (12.10), (12.11), (12.12), and (12.13).

5. Derive the recursions of the forward-backward algorithm given in equa-tions (12.14) and (12.15).

6. Consider the HMM, (X, Y ), with the structure described in Section 12.3,but with the observed quantity Yn being an p dimensional multivari-ate Gaussian random vector with conditional distribution N(µxn

, Rxn).

Show that the the following are natural sufficient statistics for the jointdistribution, p(x, y|θ), with parameters θ = [µj, Rj, τj, Pi,j : for i, j ∈ Ω].

bj =N∑

n=1

ynδ(xn − j)

Page 273: Model Based Image Processing (Text)

12.6 Chapter Problems 263

Sj =N∑

n=1

ynytnδ(xn − j)

Nj = δ(x0 − j)

Ki,j =N∑

n=1

δ(xn − j)δ(xn−1 − i) .

7. Prove Property 12.1.

8. Prove Property 12.2.

9. Property 12.3.

10. Let Xn be a Markov chain (not necessarily homogeneous) that takesvalues on the discrete set Ω. And let Yn = XDn be a subsampled versionof Xn where D is a positive integer.

a) Show that Yn is also a Markov chain.

b) Show that if Xn is a homogeneous Markov chain, then Yn is a homo-geneous Markov chain.

c) Show that if Xn is a reversible Markov chain, then Yn is a reversibleMarkov chain.

11. Consider the homogeneous Markov chain Xn∞n=0 with parameters

τj = PX0 = jPi,j = PXn = j|Xn−1 = i

where i, j ∈ 0, · · · ,M − 1. Furthermore, assume that the transitionparameters are given by

Pi,j =

1/2 if j = (i+ 1)modM1/2 if j = i0 otherwise

a) Write out the transition matrix P for the special case of M = 4. (Butsolve the remaining problems for any M .)

b) Is the Markov chain irreducible? Prove or give a counter example.

c) Is the Markov chain periodic? Prove or give a counter example.

Page 274: Model Based Image Processing (Text)

264 Markov Chains and Hidden Markov Models

d) Is the Markov chain ergodic? Prove or give a counter example.

e) Determine the value of the following matrix

limn→∞

P n

f) Is the Markov chain reversible? Prove or give a counter example.

12. Consider a Markov chain, Xn, as in Example 12.3, but with the stateslimited to the set 0, · · · ,M−1. So for i = 0, · · · ,M−2, then Pi,i+1 = λ

is the birth rate; and for i = 1, · · · ,M − 1, then Pi,i−1 = µ is the deathrate. Calculate all the values of Pi,j and the density πi that is thestationary distribution of the Markov chain.

Page 275: Model Based Image Processing (Text)

Chapter 13

General MRF Models

In the previous Chapter, we showed how state sequence estimation of HMMscan be used to label samples in a 1-D signal. In 2-D, this same approachcorresponds to image segmentation, i.e. the labeling of pixels into discreteclasses. However, in order to formalize this approach to image segmenta-tion, we will first need to generalize the concept of a Markov Chain to twoor more dimensions. As with the case of AR models, this generalization isnot so straightforward because it implies the need for non-causal prediction,which results in loopy dependencies in the model. Generally, these loopydependencies make closed form calculation of the probability mass functionimpossible due to intractable form of the so-called partition function, or nor-malizing constant of the distribution.

A common partial solution to this dilemma is to use discrete Markovrandom field (MRF) models. As with the non-Gaussian MRFs of Chapter 6,the discrete MRFs do not require imposing a 1-D causal ordering of the pixelsin the plane, and therefore they can produce more natural and isotropic imagemodels. However, as we will see, a disadvantage of MRF models is thatparameter estimation can become much more difficult due to the intractablenature of the partition function. The key theorem required to work aroundthis limitation is the Hammersley-Clifford Theorem which will be presentedin detail.

Page 276: Model Based Image Processing (Text)

266 General MRF Models

X(1,4)X(1,3)X(1,2)X(1,1)X(1,0)

X(2,4)X(2,3)X(2,2)X(2,1)X(2,0)

X(3,4)X(3,3)X(3,2)X(3,1)X(3,0)

X(0,4)X(0,3)X(0,2)X(0,1)X(0,0)

X(4,4)X(4,3)X(4,2)X(4,1)X(4,0)

Neighbors of X(2,2)

1-point clique

2-point cliques

3-point cliques

4-point cliques

Not a clique

a) b)

Figure 13.1: An eight point a) neighborhood system, and b) its associated cliques.

13.1 MRFs and Gibbs Distributions

Before we can define an MRF, we must first define the concept of a neigh-borhood system. Let S be a set of lattice points with elements s ∈ S. Thenwe use the notation ∂s to denote the neighbors of s. Notice that ∂s is asubset of S, so the function ∂ is a mapping from S to the power set of S, orequivalently the set of all subsets of S denoted by 2S.

However, not any mapping ∂s qualifies as a neighborhood system. In orderfor ∂s to be a neighborhood system, it must meet the following symmetryconstraint.

Definition 19. Neighborhood systemLet S be a set of lattice of points, then any mapping ∂ : S → 2S is a neigh-borhood system if for all s, r ∈ S

r ∈ ∂s⇒ s ∈ ∂r and s 6∈ ∂s

In other words, if r is a neighbor of s, then s must be a neighbor of r;and in addition, s may not be a neighbor of itself. Notice that this definitionis not restricted to a regular lattice. However, if the lattice S is a regularlattice, and the neighborhood is spatially invariant, then symmetry constraintnecessitates that the neighbors of a point must be symmetrically distributedabout each pixel. Figure 13.1a shows such a symmetric 8-point neighborhood.

We may now give the general definition of an MRF.

Page 277: Model Based Image Processing (Text)

13.1 MRFs and Gibbs Distributions 267

Definition 20. Markov Random FieldLet Xs ∈ Ω be a discrete (continuous) valued random field defined on thelattice S with neighborhood system ∂s. Further assume that the X has proba-bility mass (density) function p(x). Then we say that X is a Markov randomfield (MRF) if it has the property that for all x ∈ Ω

PXs = xs|Xr for r 6= s = PXs = xs|X∂r ,

for all xs ∈ Ω.1

So each pixel of the MRF is only dependent on its neighbors.

A limitation of MRFs is that their definition does not yield a naturalmethod for writing down an MRFs distribution. At times, people have beentempted to write the joint distribution of the MRF as the product of theassociated conditional distributions; however, this is generally not true. Moreformally, it is typically the case that

p(x) 6=∏

s∈Sp(xs|x∂r)

because the loopy dependencies of a MRFs non-causal structure render theresult of (12.1) invalid.

Alas, this limitation of MRFs is quite fundamental, but the good news isthat many researchers have been provided gainful employment in an attemptto solve it. Perhaps the most widely used work-around to this dilemma hasbeen the Gibbs distribution. However, in order to define the Gibbs distribu-tion, we must first introduce the concept of cliques defined below.

Definition 21. CliqueGiven a lattice S and neighborhood system ∂s, a clique is any set of latticepoints c ⊂ S such that for every distinct pair of points, s, r ∈ c, it is the casethat r ∈ ∂s.

Cliques are sets of point which are all neighbors of one another. Examplesof cliques for an eight point neighborhood system on a rectangular lattice areillustrated in Figure 13.1b. Notice, that any individual point, s ∈ S, forms aclique with the single member, c = s.

1 In the continuous case, this equality becomes PXs ∈ A|Xr for r 6= s = PXs ∈ A|X∂r , for allmeasurable sets A ⊂ Ω, and in both cases the equality is with probability 1.

Page 278: Model Based Image Processing (Text)

268 General MRF Models

In fact, cliques and neighborhood systems are alternative specificationsof the same information because for each neighborhood system, there is aunique corresponding maximal set of cliques, and for each set of cliques thereis a unique corresponding minimal neighborhood system. (See problem 1)

With this definition of cliques, we may now define the concept of a Gibbsdistribution.

Definition 22. Gibbs DistributionLet p(x) be the probability mass (density) function of a discrete (continuous)valued random field Xs ∈ Ω defined on the lattice S with neighborhood system∂s. Then we say that p(x) is a Gibbs distribution if it can be written in theform

p(x) =1

zexp

−∑

c∈CVc(xc)

(13.1)

where z is a normalizing constant known as the partition function, C isthe set of all cliques, xc is the vector containing values of x on the set c, andVc(xc) is any functions of xc.

We sometimes refer to the function Vc(xc) as a potential function andthe function

u(x) =∑

c∈CVc(xc)

as the associated energy function.

The important result that relates MRFs and Gibbs distributions is theHammersley-Clifford Theorem[6] stated below.

Theorem 13.1.1. Hammersley-Clifford TheoremLet S be an N point lattice with neighborhood system ∂s, and X be a dis-crete (continuously) valued random process on S with strictly positive prob-ability mass (density) function p(x) > 0. Then X is an MRF if and only ifp(x) is a Gibbs distribution.

So the Hammersley-Clifford Theorem states that X is an MRF if and onlyif its density function, p(x), is a Gibbs distribution. Since, Gibbs distributionsare restricted to be strictly positive, this result comes along with the technicalconstraint that X has a strictly positive density, but in practice this is aminor limitation since the density can become exceedingly small even if it isnon-zero.

Page 279: Model Based Image Processing (Text)

13.1 MRFs and Gibbs Distributions 269

Interestingly, the proof that a Gibbs distribution corresponds to an MRFis simple and constructive, while the converse proof that an MRF must havea Gibbs distribution, is not.2 (See problem 2) In practice, this means thatone typically starts with a Gibbs distribution, and from this computes theconditional dependencies of an MRF, and not the other way around.

So to prove that a Gibbs distribution corresponds to an MRF, we firstdefine Cs to be the set of all cliques that contain the pixel xs. More precisely,let Cs be a subset of all cliques, C, defined by

Cs = c ∈ C : s ∈ c , (13.2)

and let Cs = C − Cs be the set of all cliques that do not include xs. Thewe can explicitly compute the conditional distribution of xs given all otherpixels as

PXs = xs|Xr r 6= s =1z exp

−∑

c∈C Vc(xc)

xs∈Ω1z exp

−∑c∈C Vc(xc)

=exp

−∑

c∈Cs Vc(xc)

exp

−∑

c∈Cs Vc(xc)

xs∈Ω exp

−∑

c∈Cs Vc(xc)

exp

−∑

c∈Cs Vc(xc)

=exp

−∑c∈Cs Vc(xc)

xs∈Ω exp

−∑

c∈Cs Vc(xc)

=exp −us(xs|x∂s)

xs∈Ω exp −us(xs|x∂s)(13.3)

whereus(xs|x∂s) =

c∈CsVc(xc)

is only a function of xs and its neighbors. So from this, we see that

PXs = xs|Xr r 6= s = PXs = xs|Xr r ∈ ∂s ,

and Xs must be an MRF.

The Hammersley-Clifford Theorem also justifies the pair-wise Gibbs dis-tribution approach taken in Chapter 6 since neighboring pixel pairs represent

2The proof that every MRF has a Gibbs distribution depends on eliminating the possibility that thelog p(x) depends on functions of non-cliques.

Page 280: Model Based Image Processing (Text)

270 General MRF Models

X is a Markov random field&

∀x, PX = x > 0

Constructive⇐=Exists=⇒

(

PX = x has the formof a Gibbs distribution

)

Figure 13.2: Graphical illustration of the celebrated Hammersley-Clifford Theorem.

cliques in any neighborhood system. However, referring to Figure 13.1, it’sinteresting to note that even for an 8-point neighborhood system other cliquesexist; so pair-wise Gibbs distributions are certainly not the most general classof MRFs possible for a given neighborhood system. Nonetheless, the pair-wise Gibbs distributions admit a rich and useful sub-class of MRFs.

Now since most approaches start with a Gibbs distribution and then derivethe associated MRF, it is important to understand how a set of cliques caninduce a neighborhood system. So let’s say that Xs has a Gibbs distributionon the lattice S with cliques C. Then it must be an MRF, but what is thesmallest neighborhood system, ∂s, that is guaranteed to fully describe thatMRF? Formally, the answer to this question is given by the following minimalneighborhood system.

∂s = r ∈ S : ∃c ∈ C s.t. r 6= s and r, s ∈ c (13.4)

So in words, the minimal neighborhood, ∂s, must contain any pixel, r, thatshares a clique with s; and it may not contain any more pixels. Perhapsthis will become clearer when we need to use this fact in a number of laterexamples.

An important limitation of the Gibbs distribution is that typically, it isimpossible to compute or even express in simple closed form the partitionfunction z. Theoretically, z can be written as the sum over all possible statesof the random field X,

z =∑

x∈Ω|S|

exp −u(x) ,

where each point in the lattice, xs, takes on values in the discrete set Ω.However, in practice, this expression can not be evaluated since it requiresthe summation over an exponentially large set of states. This becomes aserious limitation in problems such as parameter estimation in which it is

Page 281: Model Based Image Processing (Text)

13.2 1-D MRFs and Markov Chains 271

often necessary to maximize or at least compute the likelihood as a functionof a parameter. So for example, in order to compute the ML estimate of aparameter θ, it is necessary to minimize the expression,

θ = argminθu(x) + log z(θ) ;

however, this is generally not possible to compute in closed form when theevaluation of the partition function is intractable.

Nonetheless, the Gibbs distribution is still extremely valuable when theproblem is one of estimating or maximizing over x. Since the partition func-tion is not a function of x, optimization with respect to x can be performedusing only the energy function, without regard to the potentially intractablepartition function.

x = argmaxxlog p(x) = argmin

xu(x) .

Another case of great importance occurs when we would like to sample fromthe distribution of a Gibbs distribution. This problem, which is considered indetail in Chapter 14, generally only requires the computation of the likelihoodratio between alternative states, say x and x′. In this case, the likelihood ratiocan be exactly computed from the Gibbs distribution

p(x′)

p(x)= exp u(x)− u(x′) .

13.2 1-D MRFs and Markov Chains

In order to better understand the value of MRFs, it is useful to start with the1-D case. So consider a 1-D random process, XnNn=0, which takes values onthe discrete set 0, · · · ,M − 1.

First, it is easily shown that if Xn is a Markov chain, then it must alsohave a Gibbs distribution, which further implies that it must be an MRF. Tosee this, we may write the PMF of the Markov chain as,

p(x) = p0(x0)N∏

n=1

pn(xn|xn−1)

= exp

N∑

n=1

log pn(xn|xn−1) + log p0(x0)

,

Page 282: Model Based Image Processing (Text)

272 General MRF Models

where pn(xn|xn−1) is the transition distribution for the Markov chain, andp0(x0) is the PMF of the initial state.3 If we take the potential functions tobe

Vn(xn, xn−1) = − log pn(xn|xn−1) ,for 2 ≤ n ≤ N , and

V1(xn, xn−1) = − log p1(x1|x0)− log p0(x0) .

Then with this definition, we see that the distribution of a Markov chain isa Gibbs distribution with the form

p(x) =1

zexp

−N∑

n=1

Vn(xn, xn−1)

,

where the cliques are formed by cn = n, n− 1, and the full set of cliques isgiven by C = cn : for n = 1, · · ·N.

Since Xn has a Gibbs distribution, then by the Hammersley-Clifford The-orem, Xn must be an MRF. Furthermore, its neighborhood system must bespecified by the result of equation (13.4). This means that ∂n must includeany pixel that shares a clique with n. For this simple case, the neighbors areformally specified to be

∂n = n− 1, n+ 1 ∩ 0, · · · , N .

So the neighbors of n will be the pixels on either side of n, except when nfalls on a boundary, in which case it will only have a single neighbor.

In fact, we can generalize these ideas to a P th order Markov chain. In thiscase, each sample is only dependent on the P th previous samples as definedbelow.

Definition 23. P th Order Markov ChainXnNn=0 is said to be a P th order Markov chain if for all n, thefollowing holds.

PXn = xn|Xr = xr for r < n = PXn = xn|Xn−1, · · · , Xmaxn−P,0

3Here we again assume that the probabilities are non-zero, so as to meet the technical constraint of theHammersley-Clifford Theorem, but this is not a strong restriction since these probabilities can be allowedto be very close to zero.

Page 283: Model Based Image Processing (Text)

13.2 1-D MRFs and Markov Chains 273

Since a P th order Markov chain is only conditionally dependent on the lastP values of the sequence, we can write the joint distribution of the sequenceas the product of the transition probabilities.

p(x) = p0(x0, · · · , xP−1)N∏

n=P

pn(xn|xn−1, · · ·xn−P )

Again, by taking the log, we can write this in the form

p(x) =1

zexp

−N∑

n=P

Vn(xn, · · · , xn−P )

. (13.5)

So the cliques become cn = n, · · · , n−P, and the full set of cliques is givenby C = cn : for n = 1, · · ·N.

Once again we see that the expression of equation (13.5) is a Gibbs dis-tribution, so Xn must be an MRF; and the neighborhood system of Xn mustbe given by ∂n = n − P, · · · , n − 1, n + 1, · · · , n + P ∩ 0, · · · , N. (Seeproblem 4) Therefore, in 1-D, we can see that a P th order Markov chain isalways a P th order MRF, as defined below.

Definition 24. P th Order 1-D Markov Random FieldXnNn=0 is said to be a P th order 1-D Markov random field if forall n, the following holds.

PXn = xn|Xr = xr for r 6= n= PXn = xn|Xmaxn−P,0, · · · , Xn−1, Xn+1, · · · , Xminn+P,N

So if a 1-D Markov chain is an MRF, is the converse always true? Inorder to answer this question, consider when XnNn=0 is an order P = 1MRF in 1-D. In this case, the MRF must have a Gibbs distribution witha neighborhood system given by ∂n = n − 1, n + 1 ∩ 0, · · · , N. Withthis neighborhood system, the most general set of cliques is given by C =n, n− 1 : n = 1, · · · , N.4 So therefore, we know that it must be possibleto write the Gibbs distribution with the form

p(x) =1

zexp

−N∑

n=1

Vn(xn, xn−1)

.

4Of course, any individual sample, xn, is also a clique, but, this clique’s potential function, V ′n(xn), can

always be subsumed as part of the potential function, Vn(xn, xn−1).

Page 284: Model Based Image Processing (Text)

274 General MRF Models

From this, it is easy to show that the truncated random process, from timen = 0 to N − 1 is also an MRF. We can do this by showing it also has aGibbs distribution given by

p(x0, · · · , xN−1) =M−1∑

xN=0

p(x0, · · · , xN)

=M−1∑

xN=0

1

zexp

−N∑

n=1

Vn(xn, xn−1)

=1

zexp

−N−1∑

n=1

Vn(xn, xn−1)

M−1∑

xN=0

exp −VN(xN , xN−1)

=1

zexp

−N−1∑

n=1

Vn(xn, xn−1)

exp −V ′N−1(xN−1)

=1

zexp

−N−1∑

n=1

Vn(xn, xn−1)− V ′N−1(xN−1)

,

where all but the last of the potential functions are the same.

Using this result, we can also compute the conditional PMF of Xn givenXr for r < n as,

p(xN |xr for r < N) =p(x0, · · · , xN)p(x0, · · · , xN−1)

=

1z exp

−∑Nn=1 Vn(xn, xn−1)

1z exp

−∑N−1

n=1 Vn(xn, xn−1)− V ′N−1(xN−1)

= exp −VN(xN , xN−1) + V ′N−1(xN−1)

=1

z′exp −VN(xN , xN−1)

= p(xN |xN−1) ,

where z′ =∑M−1

xN=0 exp −VN(xN , xN−1).So applying this result, along with mathematical induction, we see that

every 1-D MRF of order 1 is also a 1-D Markov chain of order 1. In fact,

Page 285: Model Based Image Processing (Text)

13.3 Discrete MRFs and the Ising Model 275

the generalization of this proof to P th order 1-D MRFs and Markov chainsis direct (but with nasty notional issues). This results in the following veryimportant property for 1-D random processes.

Property 13.1. Equivalence of 1-D MRFs and Markov chains - Let XnNn=0

be discrete time random process with strictly positive PMF taking values ona finite discrete set. Then X is a P th order MRF if and only if it is a P th

order Markov chain.

Of course, the sums in the proof can easily be replaced with integrals, so asimilar result holds for discrete-time processes with strictly positive densities.That is, Xn is a P th order 1-D discrete-time Markov process with a strictlypositive PDF, if and only if it is P th order 1-D MRF with a strictly positivePDF.

In some sense, this would seem to be a major disappointment. If MRFsand Markov chains are equivalent, why bother with MRFs at all? Well theanswer is that MRFs are rarely used in 1-D for this exact reason. However,in the following sections, we will see that in two a more dimensions, MRFsare quite different than 2-D Markov processes, and can exhibit interestingand useful characteristics.

13.3 Discrete MRFs and the Ising Model

Perhaps the first serious attempts to generalize Markov chains to multiple di-mensions came from the physics community in an effort to model the behaviorand properties of magnetic dipoles in real materials. Amazingly enough, someof this early research resulted in closed form expressions for the behavior ofthese highly non-linear systems, but they achieved this goal by restrictingtheir analysis to simple 2-D models with 4-point neighborhoods.

In the 1920’s, it was well known that magnetic materials exhibit a phasetransition when the temperature falls below the Curie temperature. Belowthis critical temperature, the magnetic material will spontaneously mag-netize itself, but above the critical temperature it will not. Wilhelm Lenz[43] and his student, Ernst Ising [39], proposed what is now known as theIsing model in an attempt to mathematically model this unique physicalbehavior.

Page 286: Model Based Image Processing (Text)

276 General MRF Models

The Ising model is formed by a lattice of binary random variables that areused to model the states of magnetic dipoles. Each binary variable, Xs, cantake on the value +1 or −1, indicating either a North or South orientationof the corresponding dipole. The potential energy associated with a pair ofneighboring dipoles is then approximated as −Jxsxr where s ∈ ∂r and Jis a positive constant. So if the neighboring dipoles are misaligned, (i.e.,xs = −xr), then the potential energy is J ; and if they are aligned, (i.e.,xs = xr), then the potential energy falls to −J . Using this model, the totalenergy of the lattice is given by

u(x) = −∑

s,r∈CJxsxr ,

where C is the set of all neighboring pixel pairs (i.e., cliques).

The question that next arrises is, what is the distribution of the dipolestates in the Ising model? For a physical system, the question is answeredby the Boltzmann distribution (also known as the Gibbs distribution) ofthermodynamics. The Boltzmann distribution has the form

p(x) =1

zexp

− 1

kbTu(x)

,

where u(x) is the energy associated with the state x. The Boltzmann distri-bution is derived for a system in thermodynamic equilibrium by finding thedistribution of states that maximizes the entropy of the system subject to aconstraint that the expected energy be constant. (See Appendix B and prob-lem 6 for a derivation of this result.) So for the Ising model, the Boltzmanndistribution of states has the form

p(x) =1

zexp

1

kbT∑

s,r∈CJxsxr

. (13.6)

Since this is a Gibbs distribution, then we know that p(x) must be the dis-tribution of an MRF with cliques given by C.

In order to be able to analyze the properties of this model, Ising firstassumed the lattice to be only one dimensional. Now we know from Sec-tion 13.2 that any 1-D MRF of order P is a 1-D Markov chain of order P .So this 1-D approximation allowed Ising to exactly analyze the behavior of

Page 287: Model Based Image Processing (Text)

13.3 Discrete MRFs and the Ising Model 277

the lattice. However, in 1-D, the Ising model no longer exhibits the criticaltemperature behavior! So let Xn be the 1-D random process resulting fromthe Ising model, and assume that we know that X0 = 1. Then as n→∞, weknow that the Markov chain will converge to a stationary distribution andXn will be independent of the initial value, X0. This means that in 1-D theinitial state has no lasting effect.

However, in 2-D, Gibbs distributions no longer can be represented as sim-ple Markov chains. So the analysis is much more difficult, but also turnsout to yield much richer behavior. In fact in 1936, Peierls first provided aprecise argument that in 2-D the Ising model exhibits the expected criticaltemperature behavior [50]. So below a specific critical temperature, dipolesin the random field remain correlated regardless of how far apart they are.Later this analysis was made more precise when in 1944 Onsager was able toobtain a closed form expression for the infinite lattice case [48].

In order to better understand the Ising model, we first make the standardmodeling assumption of a 2-D rectangular lattice with a 4-point neighborhoodsystem, and cliques formed by neighboring horizontal or vertical pixel pairs.If we use the notation, δ(xr 6= xs), as an indicator function for the eventxr 6= xs, then we can rewrite the Ising distribution in the form

p(x) =1

zexp

J

kbT∑

r,s∈Cxrxs

=1

zexp

J

kbT∑

r,s∈C(1− 2δ(xr 6= xs))

.

This results in a new expression for the distribution of an Ising model

p(x) =1

z(β)exp

−β∑

r,s∈Cδ(xr 6= xs)

, (13.7)

where

β ,2J

kbT(13.8)

is a standard parameter of the Ising model that is inversely proportional tothe temperature. Notice that we write z(β) to emphasize the dependence of

Page 288: Model Based Image Processing (Text)

278 General MRF Models

the partition function on β. Generally, it is more convenient and intuitive towork with the unitless parameter of β than to work with the temperature Tdirectly.

From the form of (13.7), we know that p(x) is a Gibbs distribution withpair-wise cliques. In 2-D, the Ising model uses horizontal and vertical cliques,so by the Hammersly-Clifford Theorem, we also know that X must be a MRFwith a 4-point neighborhood. More directly, we can compute the conditionaldistribution of a pixel xs given its neighbors xr for r ∈ ∂s to yield

p(xs|xi 6=s) =exp

−β∑r∈∂s δ(xs 6= xr)

exp

−β∑r∈∂s δ(1 6= xr)

+ exp

−β∑r∈∂s δ(−1 6= xr) .

(13.9)In order to further simplify this expression, we can define v(xs, ∂xs) to be thenumber of horizontal/vertical neighbors that differ from xs.

v(xs, x∂s) ,∑

r∈∂sδ(xs 6= xr) (13.10)

From this we can compute the conditional probability that xs = 1 as

p(1|xi 6=s) =1

1 + e2β[v(1,x∂s)−2] . (13.11)

Figure 13.3 shows a plot of the function in equation (13.11). First, notice thatthe conditional probability is only a function of v(1, ∂xs), that is the numberof neighbors not equal to 1. When β > 0, then as v(1, ∂xs) increases, theprobability that Xs = 1 decreases. A special case occurs when v(1, ∂xs) = 2.In this case, half of the neighbors are 1, and half are −1, so p(xs|x∂s) = 1/2.

Generally speaking, when β is very large and positive, a pixel is highlylikely to be the same polarity as the majority of its neighbors. However, ifβ << 0, then the opposite occurs, and pixels are likely to be the oppositepolarity of their neighbor. In the transitional case, when β = 0, the pixels inthe Ising model are all independent. Intuitively, β = 0 corresponds to T =∞,so at infinite temperature, the dipoles of the lattice are highly disordered withno correlation between them.

Figure 13.4 provides additional intuition into the behavior of the Isingmodel. Notice that with its 4-point neighborhood, the energy function of the

Page 289: Model Based Image Processing (Text)

13.3 Discrete MRFs and the Ising Model 279

0 1 2 3 40

0.2

0.4

0.6

0.8

1

Probability that Xs = 1

Number of neighbors not equal to 1

Pro

babi

lity

β = 0.00β = 0.25β = 0.50β = 0.75β = 1.00β = 1.25

Figure 13.3: Conditional density of a pixel given its neighbors for a 2-D Ising model.Notice that the probably that Xs = 1 increases as the number of neighbors equal toone increase. This tendency also becomes stronger as β increases.

Ising model is equal to the total boundary length scaled by the constant β.

β∑

r,s∈Cδ(Xr 6= Xs) = β(Boundary length)

So with this interpretation, we might expect that longer boundaries shouldbecome less probable as the value of β increases. However, this is not neces-sarily the case because as the length of a boundary increases the total numberof possible boundaries of a given length can increase quite rapidly.

The complex nature of the 2-D Ising model is perhaps best illustrated bythe existence of a critical temperature below which the correlations in thelattice extend to infinite distances. Figure 13.5a illustrates an Ising modelof size N × N with a boundary specified by the set of lattice points B. Soone might expect that as the size the the lattice, N , tends to infinity, thenthe choice of the boundary as either XB = 1 or XB = −1 would not effectthe pixels in the center of the lattice. However, this is not true. In 1936,Peierls first showed this surprising result using a clever proof based on argu-ments about the probability of a boundary surrounding the center pixel [50].Kinderman and Snell provide a simplified example of this proof techniqueon page 13 of [42] to show that for β sufficiently large the probability of thecenter pixel, X0, can be made arbitrarily small. For β > βc, it can be shown

Page 290: Model Based Image Processing (Text)

280 General MRF Models

- - - -

- - - -

- - - +

- - - +

- - - -

- + + -

+ + + -

+ - -

- - - -

- - - -

- - - -

- - - -

- + - -

+ + - -

- + - -

- - - -

+

Cliques: Xr Xs Xr

Xs

Boundary:

Figure 13.4: Example of a 2-D Ising models structure using a 4-point neighborhood.In this case, the energy is proportional to the boundary length traced between pixelsof opposite sign.

thatlimN→∞

PX0 = −1|XB = 1 < 1/2 .

In fact, by choosing β sufficiently large, it can be shown that limN→∞ PX0 =−1|XB = 1 < ǫ for any ǫ > 0. This means that the choice of a boundaryeffects the behavior of the Ising model even as the boundary goes to infinity.This is a behavior which is distinctly different than the behavior of a ergodic1-D Markov chain, in which the effect of the initial value decays with time.

Example 13.1. In this example, we provide a simple geometric proof originallyfrom Kinderman and Snell (See [42] page 13) that there exists a critical value,βc, above which correlations in the lattice extend to infinite distances. Theproof works by first bounding the correlation for the case of an N×N lattice,and then taking the limit as N →∞.

Figure 13.5a illustrates the situation in which an N ×N Ising MRF has acenter pixelX0 which is surrounded by a outer boundary of values B. Our ob-jective will be to show that for β sufficiently large, PNX0=−1|B=1 < 1/3.Once we have proven this, we than know that

limN→∞

PNX0=B ≥ 2/3 ,

which means that the value of X0 and the boundary B are correlated re-gardless of how large the lattice becomes. So intuitively, this center pixel ofthe random field is effected by the boundary regardless of how far away theboundary moves.

Page 291: Model Based Image Processing (Text)

13.3 Discrete MRFs and the Ising Model 281

In order to formulate the proof, we will first need to define some notation.Consider a particular configuration x for which x0 = −1 and B = 1. Thenwe know there must be a closed boundary that surrounds the lattice point at0 and that contains all the pixels with label −1 that are connected through4-point neighbor relation to the pixel X0 = −1. This boundary and theassociated set of pixels inside the boundary are illustrated in Figure 13.5a.

Now let Ω = +1,−1N2

denote the set of all binary images, and let L(x)be the total boundary length associated with neighboring pixels of oppositepolarity. Then the probability distribution of X given B = 1 has the form

PX = x|XB = 1 = 1

zexp −βL(x) .

Now let c(x) denote the closed boundary around the pixel X0 that includesall pixels of value −1. Notice that all pixels inside the curve, c(x), must havevalue −1, and all values immediately outside the curve must be +1.5 Inaddition, since the outer boundary is assumed to be all 1′s (i.e., B = 1) andX0 = −1, then c(x) must exist as a separation between the change in thesetwo states. We will denote the length of this separating curve by L(c(x)).Figure 13.5a) illustrates the situation with X0 = −1 and c(x) denoted by abold line of length L(c(x)) = 24 enclosing 15 pixels each with the value −1.

Next, consider the set of all fields, x, such that x0 = −1, and c(x) = co.

Ωco , x ∈ Ω : c(x) = co and x0 = −1 .

So then for any x ∈ Ωco, we know that all the pixels inside the boundary cowill have value −1 including x0, and all the neighboring pixels on the outsideboundary of co will be +1.

Now for each x ∈ Ωco, we can define a “flipped” version of x by reversingthe polarity of the pixels inside the boundary co, but leaving the pixels outsidethe boundary unchanged. So if x′ = fco(x) is the flipped version of x, then

x′s = fco(x) =

1 s lies inside the boundary coxs s lies outside the boundary co

.

Notice that the flipped version, x′s, no longer has a boundary along co. Fur-thermore, we can define the set of all flipped configurations as

Ω′co , x′ ∈ Ω : x′ = fco(x) for some x ∈ Ωco .

5Of course, diagonal neighbors to the curve can be −1, and so can pixels that do not neighbor the curve.

Page 292: Model Based Image Processing (Text)

282 General MRF Models

Center Pixel X0:

B B B B

B + + +

B + + -

B + + -

B B B B

+ - - B

- - - B

- + B

B + + +

B + + +

B + + +

B B B B

+ - + B

- - + B

+ - + B

B B B B

-

B + + + + - - B

B

+

+

+

+

+

+

B

+

N

N

0 1 2 3 4 5−0.5

0

0.5

1

1.5

Inverse Temperature

Mea

n F

ield

Val

ue

a) b)

Figure 13.5: In 2-D, the Ising model exhibits a unique critical temperature behaviorin which the correlations between pixels in the model can extend to infinite distances.a) This figure illustrates the approach first used by Peierls and latter adapted byKinderman and Snell to prove the existence of the critical temperature. b) This plotshows the exact value of the mean field strength of an infinite lattice with a boundarycondition of XB = 1. The analytic result comes from Onsager’s closed-form analysisof the Ising model as N →∞.

So the elements of Ω′co are just the flipped versions of the elements of Ωco.Now, notice that with this definition, each element of Ω′co corresponds to aunique element of Ωco; so the elements in the two sets are in a one-to-onecorrespondence, and the sets are assured to have the same size, i.e. |Ωco| =|Ω′co|.

Finally, we observe that for each element x ∈ Ω, the total boundary lengthin the flipped version is shortened by L(c(x)). So the total boundary lengthin x and f(x) must be related as

L(f(x)) = L(x)− L(co) , (13.12)

where L(co) denotes the length of the curve co.

With these facts in mind, we can now upper bound the probability of theevent that a particular boundary co occurs along with X0 = −1,

PNc(X) = co, X0 = −1|B = 1 =1

z

x∈Ωco

exp −βL(x)

=

x∈Ωco

exp −βL(x)∑

x∈Ωexp −βL(x)

Page 293: Model Based Image Processing (Text)

13.3 Discrete MRFs and the Ising Model 283

x∈Ωco

exp −βL(x)∑

x∈Ω′co

exp −βL(x)

=

x∈Ωco

exp −βL(x)∑

x∈Ωco

exp −βL(f(x))

=

x∈Ωco

exp −βL(x)

expβL(co)∑

x∈Ωco

exp −βL(x)

= e−βL(co) ,

where line three uses the fact that Ω′co ⊂ Ω, line four uses the fact thatelements of Ωco and Ω′co are in one-to-one correspondence, and line five usesequation (13.12). So this results in the bound that

PNc(X) = co, X0 = −1|B = 1 ≤ e−βL(co) , (13.13)

Now to bound PNX0 = −1|B = 1, we must sum the upper bound ofequation (13.13) over all possible boundaries co. To do this, we define theset CL to contain all boundaries, co, of length L, such that the interior of cincludes the center pixel X0. Then using this definition, we have that

PNX0 = −1|B = 1 =∞∑

L=4

co∈CL

Pc(x) = co, X0 = −1|B = 1

≤∞∑

L=4

co∈CL

e−βL

=∞∑

L=4

|CL| e−βL .

So then the question becomes, how many such boundaries of length L arethere? Well, the boundaries must have even length, so |CL| = 0 for L odd.

Page 294: Model Based Image Processing (Text)

284 General MRF Models

The boundary must also be within L/2 of the point X0; so there can onlybe L2 ways to select the starting point of the boundary, and once chosen,only 4 possibilities for the initial direction. For each subsequent step, thereare only 3 possible choices of direction. Putting this together, we have that|CL| ≤ 4L23L for L even. Setting L = 2n, this leads to

PNX0 = −1|B = 1 ≤∞∑

n=2

4(2n)232n e−β2n

=∞∑

n=2

16n2(

9e−2β)n

.

It is clear that for β sufficiently large, we can ensure that

PNX0 = −1|B = 1 ≤∞∑

n=2

16n2(

9e−2β)n

< 1/3 ;

so we have proved the desired result.

Amazingly, in 1944, Onsager was able to obtain closed form expressionsfor properties of the Ising model as N → ∞ [48]. One representative resultfrom this analysis is the following expression for the conditional expectationof a pixel in the lattice given that the boundary at infinity is XB = 1.

limN→∞

EN [X0|B = 1] =

(

1− 1(sinh(β))4

)1/8

if β > βc

0 if β < βc(13.14)

This expression, plotted in Figure 13.5b, clearly illustrates the critical tem-perature behavior of the Ising model. For values of β below a critical valueof βc ≈ 0.88, the expected value of a pixel in the field is zero. This is whatyou would expect if the effect of the boundary were to become negligible asit tends towards infinity. However, for β > βc (i.e., T < Tc) where βc ≈ 0.88,this symmetry is broken, and the expectation moves towards 1. In fact, forlarge values of β, the expectation approaches 1, which means that X0 = 1with high probability.

Intuitively, this happens because when β is above the critical value, therandom field’s distribution becomes bi-modal, tending to be either nearly

Page 295: Model Based Image Processing (Text)

13.3 Discrete MRFs and the Ising Model 285

all values of 1 or nearly all values of −1. Clearly, without the boundarycondition, the probability of X and −X (i.e., the random field with the signof each pixel reversed) must be the same due to the symmetry in the densityof equation 13.6. However, the assumption of a boundary of B = 1 breaksthis symmetry in the model, and favors the mode associated with a majorityof 1’s in the lattice. In this case, values of −1 only occur in primarily isolatedlocations.

The Ising model can be generalized to a wider range of similar models,but typically in these more general cases, it is no longer possible to computeclosed form solutions to properties of the model. A simple and very usefulgeneralization of the Ising model is to an M-level discrete MRF withtypically an 8-point neighborhood. So for a 2-D lattice, let C1 denote the setof horizontal and vertical cliques and let C2 denote the set of diagonal cliques.Then we may define the following two statistics

t1(x) ,∑

s,r∈C1

δ(xr 6= xs) (13.15)

t2(x) ,∑

s,r∈C2

δ(xr 6= xs) , (13.16)

where t1(x) counts the number of vertically and horizontally adjacent pixelswith different values, t2(x) counts the number of diagonally adjacent pixelswith different values, and the pixels xs are assumed to take values in the set0, · · · ,M − 1. From this, we can express the distribution of an M -levelMRF as

p(x) =1

zexp −(β1t1(x) + β2t2(x)) . (13.17)

We can also compute the conditional distribution of a pixel, Xs, givenits neighbors, X∂s. In order to compactly express this, we can first definethe functions v1 and v2 which count the number of horizontal/vertical anddiagonal neighbors with a different value from Xs. These functions are givenby

v1(xs, x∂s) ,∑

r∈[∂s]1

δ(xs 6= xr)

v2(xs, x∂s) ,∑

r∈[∂s]2

δ(xs 6= xr) ,

Page 296: Model Based Image Processing (Text)

286 General MRF Models

where [∂s]1 is the set of horizontally and vertically adjacent neighbors to s,and [∂s]2 is the set of diagonally adjacent neighbors to s. Using this notation,we can then express the conditional distribution of Xs given its neighbors as

p(xs|xr 6=s) =exp −β1v1(xs, x∂s)− β2v2(xs, x∂s)

∑M−1m=0 exp −β1v1(m, x∂s)− β2v2(m, x∂s)

.

In this form, it is clear that when β1, β2 > 0, the pixel Xs is more likely totake on a value that is shared by a number of its neighbors.

13.4 2-D Markov Chains and MRFs

In Section 13.2, we showed that the 1-D Markov chain and 1-D MRF representequivalent models. Therefore, as a practical matter, a Markov chain modelis almost always preferred in 1-D since, in many ways, it is more tractable.

So this raises the question, are 2-D Markov chains and 2-D MRFs equiva-lent? The answer to this is “no”. We will show that MRFs are more generalin two or more dimensions, or when the lattice forms a general graph ratherthan a 1-D sequence or tree. In fact the relationship of Markov chains toMRFs in 1 and 2 dimensions, is largely analogous the relationship betweenAR models and Gaussian MRFs as described in Chapter 3.

We will start by first defining P th order Markov chains and Markov randomfields in 2-D. To do this, we will need to re-introduce the 2-D causal orderingof points in a plane, as first described in Section 3.4. Figure 3.3b illustratesthe 2-D window of causal neighbors of a point using raster ordering. Moreformally, the the causal neighbors of the point s are the points s− r, wherer ∈ WP , and WP is a P th order window as defined in equation (3.12).

Using the same approach as in Section 13.2, we first define a 2-D Markovchain of order P .

Definition 25. P th order 2-D Markov ChainLet S be a 2-D rectangular lattice. Then Xss∈S is said to be a P th

order 2-D Markov chain if for all s, the following holds,

PXs = xs|Xr = xr for r < s = PXs = xs|Xs−r r ∈ WP ,

where WP is defined as in equation (3.12) of Section 3.4.

Page 297: Model Based Image Processing (Text)

13.4 2-D Markov Chains and MRFs 287

• • • • •• • • • •• • ⊗

• • • • • • •• • • • • • • • •• • • • ⊗ • • • •• • • • • • • • •• • • • • • •

(a)Causal neighborhood and cliquestructure for 2-D Markov chain of

order P = 2

(b)MRF neighborhood resulting froma 2-D Markov chain of order P = 2

Figure 13.6: Figure illustrating how a 2-D Markov chain of order P is still an MRF,but with an order of 2P . (a) Illustration of the lattice points that form cliques in theGibbs distribution of a 2-D Markov chain. (b) The associated MRF neighborhood isformed by the autocorrelation of the clique structure and results in an asymmetricneighborhood system.

In order to simplify notation, let s−WP denote the set of previous pixellocations in the Markov chain. Figure 13.6a illustrates that the set s−WPis an asymmetric causal window which only includes pixels that occurredbefore s in raster order. Now if Xs is a 2-D Markov chain of order P , we canwrite the joint distribution of X as6

p(x) =∏

s∈SPXs = xs|Xs−WP

= xs−WP .

If we also assume the technical condition that p(x) is strictly positive, thenwe know we can write this as a Gibbs distribution with the form

p(x) =1

zexp

−∑

s∈SVs(xs, xs−WP

)

, (13.18)

where the potential functions are defined by

Vs(xs, xs−WP) = − logPXs = xs|Xs−r = xs−WP

.

From the form of equation (13.18), we can see that the 2-D Markov chainhas a Gibbs distribution.

By the Hammersley-Clifford Theorem, we know that since Xs has a Gibbsdistribution, it must be an MRF with associated cliques of cs = s, s −

6For notational simplicity, we ignore the initialization terms of the Markov chain that occur along theboundaries of a finite MRF. In fact, the expression still holds as long as the conditional probability isinterpreted to be simply the probability when the conditioning variables are unavailable.

Page 298: Model Based Image Processing (Text)

288 General MRF Models

WP, and a complete set of cliques given by C = cs : s ∈ S. From thiswe may determine the neighborhood system of the MRF. In particular, weknow from equation (13.4) that ∂s must contain any pixel, r, that shares aclique with s. With a little thought, it becomes clear that the associatedneighborhood system for this set of cliques can be determined by performingthe 2-D autocorrelation of the cliques, cs, with themselves. The result isshown in Figure 13.6b. In fact, the relationship between these cliques andthe neighborhood of the MRF is precisely the same relationship as discussedin Section 4.5 for the Gaussian MRF with pairwise cliques.

From this, we can define a 2-D Markov random field of order P . Thenatural definition is that each pixel is dependent on a (2P + 1) × (2P + 1)non-causal neighborhood of surrounding pixels. So with this definition, andour previous results, we can see that a 2-D Markov chain of order P must bea 2-D MRF of order 2P .

Definition 26. P th order 2-D Markov Random FieldLet S be a 2-D rectangular lattice with neighborhood system

∂(s1, s2) = (r1, r2) ∈ S : 0 < max|r1 − s1|, |r2 − s2| ≤ P .

Then Xss∈S is said to be a P th order 2-D Markov random field if forall s, the following holds,

PXs = xs|Xr = xr for r 6= s = PXs = xs|X∂s .

Since in 2-D a Markov chain is an MRF, one might again wonder if anMRF can be represented as a Markov chain? In fact, this is generally not thecase. So as an example, consider the Ising model of equation (13.7). In thiscase, the conditional distribution of a pixel, Xs, given the past pixels, Xr forr < s, and be computed as

P Xs = xs|Xr = xr r < s = P Xs = xs, Xr = xr r < s∑M−1

m=0 P Xs = m,Xr = xr r < s.

However, in order to compute the joint density of the numerator, we need toperform a sum over all pixels xk for k > s,

P Xs = xs, Xr = xr r < s =∑

xk for k > s

1

z(β)exp

−β∑

i,j∈Cδ(xi 6= xj)

,

Page 299: Model Based Image Processing (Text)

13.4 2-D Markov Chains and MRFs 289

where again k = (k1, k2) denotes a vector index. Some manipulation of theseterms then results in a conditional distribution with the form

P Xs = xs|Xr = xr r < s = P Xs = xs|Xr = xr r ∈ Bs ,

where Bs is a set of boundary pixels that precede the pixel s and lie alongtwo rows of the image.

......

......

......

......

......

......

......

...· · · • • • • • • • • • • • • • • • · · ·· · · • • • • • • • • • • • • • • • · · ·· · · • • • • • • • • • • • • • • • · · ·· · · • • • • • • • • • • • • • • • · · ·· · · • • • • • • • Bs Bs Bs Bs Bs Bs Bs Bs · · ·· · · Bs Bs Bs Bs Bs Bs Bs ⊗

Figure 13.7: This figure illustrates the causal neighborhood of a pixel s which makesXs conditionally independent of the past for an Ising model with a 4-point neighbor-hood. The symbol ⊗ denotes the location of the pixel s, and the set of points labeledBs indicate the positions necessary to make Xs conditionally independent of the past.

Figure 13.4 illustrates the structure of this set, Bs, relative to the pixel s.Importantly, the set Bs extends indefinitely to the left and right. This meansthe the random field Xs is not a 2-D Markov chain for any fixed finite valueof P . Consequently, even with this simple example of the Ising model, wecan see that MRFs are not generally 2-D Markov chains. In fact, this makessense because if all MRFs were Markov chains, then we would expect thattwo pixels, Xs and Xr, would become decorrelated when the lattice points sand r become sufficiently far apart. However, we know from the discussionof critical temperature in Section 13.3 that this does not happen when β isgreater than the critical value.

Figure 13.8 illustrates the relationships between Markov chains and MRFsgraphically with a Venn diagram. The Venn diagram only treats discrete ran-dom processes with PMFs that are strictly positive, but the results typicallyapply to a boarder class of continuous random processes with well defineddensities. Notice that in 1-D, Markov chains and MRFs parameterize thesame family of models, so they are equally expressive. However, in 2-D,MRFs are more general than Markov chains. More specifically, 2-D Markovchains of order P are always 2-D MRFs, but of order 2P .

Page 300: Model Based Image Processing (Text)

290 General MRF Models

2−D MRF: order 2P

Discrete Random Processes1−D MRF:order P1−D MC: order P

2−D MRF: order P2−D MC: order P

with Positive Distribution

Figure 13.8: Venn diagram illustrating the relationship between Markov chains (MC)and Markov Random Fields (MRF) in 1 and 2-D among the set of all discrete-staterandom processes with strictly positive distribution. Notice that in 1-D, Markov chainand MRF models are equivalent, but in 2-D they are not.

13.5 MRF Parameter Estimation

Perhaps the greatest practical deficiency of MRFs is the general difficulty ofestimating parameters of MRF models. In fact, typical MRF models havea relatively small number of parameters in order to minimize the difficultiesassociated with parameter estimation.

The difficulty in MRF parameter estimation results from the fact that thepartition function is typically not a tractable function of the parameters. Sofor example, in the general case, the MRFs distribution can be written as aGibbs distribution with the form

pθ(x) =1

z(θ)exp −uθ(x) ,

where uθ(x) is the energy function parameterized by θ, and z(θ) is the parti-tion function. In this form, the ML estimate is given by

θ = argmaxθ

log pθ(x)

= argminθuθ(x) + log z(θ) .

Typically, the ML estimate is difficult to compute because the term z(θ)does not have a tractable form. However, it is still possible to make a bitmore progress in analyzing this expression. Assuming the the quantities

Page 301: Model Based Image Processing (Text)

13.5 MRF Parameter Estimation 291

are all differentiable and that the ML estimate does not lie on a constraintboundary, then a necessary condition is that the ML estimate, θ, solve thefollowing equation,

∇uθ(x) = −∇z(θ)z(θ)

,

where the gradient is with respect to θ. Now by using the definition of thepartition function, and applying some simple calculus, it is easily shown that

−∇z(θ)z(θ)

=∑

x∈ΩN

∇uθ(x)1

z(θ)exp

−uθ(x)

= Eθ

[

∇uθ(X)]

.

So the ML estimate of the parameter, θ, is given by the solution to theequation

∇uθ(x) = Eθ

[

∇uθ(X)]

. (13.19)

It is often the case that the Gibbs distribution is parameterized as an expo-nential family so that it can be written as

uθ(x) = T (x)θ

where T (x) is a 1×k row vector and θ is a k×1 column vector. For instance,this is the case in the example of equation (13.17) where T (x) = [t1(x), t2(x)]and θ = [β1, β2]

t. In this case, ∇uθ(x) = T (x), and the relationship ofequation (13.19) becomes

T (x) = Eθ [T (X)] . (13.20)

Equation (13.20) has the intuitively appealing interpretation that, to computethe ML estimate, one must adjust the components of the parameter θ untilthe expected values of the statistics, (i.e., Eθ [T (X)]) match the observedvalues of the statistics, (i.e., T (x)).

Of course, the difficulty in solving equation (13.20) is computing the re-quired expectation. One approach to solving this problem numerically isto approximately compute the expectation using the simulation techniquesof that will be introduced in Chapter 14. Methods such as the Metropo-lis, Hastings-Metropolis, and Gibbs sampler provide techniques to generatesequences of samples from the distribution of X using parameter θ. So for

Page 302: Model Based Image Processing (Text)

292 General MRF Models

example, simulation methods can be used to generate M samples from theGibbs distribution with the parameter θ. Then the following error can becomputed as

∆T ← T (x)− 1

M

M∑

m=1

T (X(m)θ ) ,

where X(m)θ Mm=1 are the M samples of X generated from the distribution

with parameter θ. Using this error, the parameters of θ can be adjusted bydecreasing its components in proportion to the error

θ ← θ − α∆T ,

where α is a user selected step size. In any case, this approach to ML es-timation can be very computationally expensive since it requires the use ofstochastic sampling techniques, and its convergence can be fragile.

A much more commonly used approach to ML estimation for MRF pa-rameters is the so called maximum pseudo-likelihood (MPL) estimator[7, 8]. The MPL estimator works by replacing the true likelihood with the so-called pseudo likelihood that does not include the dreaded partition function.Since X is a assumed to be an MRF, we know that it is possible to write theconditional distributions of pixels given all other pixels as pθ(xs|x∂s), where∂s is the set of neighbors to the pixel s. So the pseudo-likelihood function isdefined as

PL(θ) =∏

s∈Spθ(xs|x∂s) .

Of course, the pseudo-likelihood is not the actual likelihood because thedependencies in the MRF are loopy. Nonetheless, we can use the pseudo-likelihood as a criteria for optimization in parameter estimation. More specif-ically, the maximum pseudo-likelihood estimate of the parameter θ is thengiven by

θ = argmaxθ

s∈Slog pθ(xs|x∂s)

So the maximum pseudo-likelihood estimate is based on the strategy of sim-ply ignoring the loopy nature of the MRF dependencies and computing thelikelihood as if the probabilities formed a Markov chain.

However, one glitch in the approach is that in applications the parameterθ typically is used to parameterize the Gibbs distribution rather than the

Page 303: Model Based Image Processing (Text)

13.5 MRF Parameter Estimation 293

conditional probabilities themselves.7 So therefore, using the MPL approachrequires that the conditional distributions must be expressed in terms of theassociated Gibbs distribution using Bayes’ rule. This results in a complex andtypically nonlinear relationship between the parameters, θ, and the psuedo-likelihood expression to be optimized. So consider a Gibbs distribution withthe form

pθ(x) =1

zexp

−∑

c∈CVc(xc|θ)

.

Once again, we can define Cs to be the set of all cliques that contain the pixelxs. With this notation, it is easily shown that

pθ(xs|x∂s) =exp

−∑c∈Cs Vc(xc|θ)

xs∈Ω exp

−∑

c∈Cs Vc(xc|θ) .

So using this expression, the functional form of the maximum pseudo-likelihoodestimate is given by

θ = argmaxθ

s∈Slog

(

exp(

−∑

c∈Cs Vc(xc|θ)

xs∈Ω exp

−∑c∈Cs Vc(xc|θ)

)

. (13.21)

While this expression is not very pretty, it can be numerically optimized. Inparticular, it is tractable because the sum in the denominator of each term isonly over individual pixels, xs, rather than the entire MRF. However in prac-tice, this expression tends to be a highly nonlinear function of the parameterθ, so numerical optimization can be tricky. Nonetheless, an important advan-tage of the maximum pseudo-likelihood estimate is that it has been shown tobe consistent [29], so it is typically better than completely ad-hoc parameterestimates, which often are not.

7 It is generally necessary to parameterize the Gibbs distribution rather than the conditional probabilitiesbecause the Hammersley-Clifford Theorem does not say how to construct the full distribution from the con-ditional distributions. Also, a given set of conditional distributions are not likely to consistently correspondto any overall joint distribution.

Page 304: Model Based Image Processing (Text)

294 General MRF Models

13.6 Chapter Problems

1. In the following problem, we show that for every neighborhood system,there is a unique set of cliques, and for every set of cliques there is aunique neighborhood system.

a) Show that for any neighborhood system, ∂s, there is a unique largestset of cliques, C. We say that the set of cliques C is larger than the setof cliques C ′ if C ′ ⊂ C.b) Show that for any set of cliques, C, there is a unique smallest neighbor-hood system. Here we say that the neighborhood system ∂s is smallerthan the neighborhood system ∂′s, if for all s ∈ S, ∂s ⊂ ∂′s.

2. Let X be a discrete valued random field on a lattice, and assume that itsPMF has the form of a Gibbs distribution with neighborhood system ∂s

and associated cliques C. Then show thatX is a MRF with neighborhoodsystem ∂s.

3. Let XnNn=0 be a P th order Markov chain. Furthermore, define the newrandom process, YnNn=0, given by Yn = (Xn, · · · , Xmaxn−P,0). Thenshow that Yn is a Markov chain of order P = 1.

4. Prove that in 1-D a P th order Markov chain is also a P th order MRF.

5. Prove that in 1-D a P th order MRF is also a P th order Markov chain.

6. In this problem, we will derive the general form of the discrete distribu-tion known as the Boltzmann or Gibbs distribution of Appendix B.

a) Derive the result of equation (B.2).

b) Derive the result of equation (B.3).

c) Derive the results of equations (B.5), (B.6), and (B.7).

d) For a system in thermodynamic equilibrium, is it possible for thetemperature, T , to be negative? Use the Ising model to propose anexample of a physical system with negative temperature.

7. Using the Ising distribution specified by equation (13.7), do the follow-ing:

Page 305: Model Based Image Processing (Text)

13.6 Chapter Problems 295

a) Show that in 2-D the conditional distribution of a pixel given itsneighbors has the form of equation 13.11;

b) Plot the conditional probability p(xs = 1|xi 6=s) as a function ofv(1, x∂s) with β = −1, 0, 0.5, and 1.

c) What would a “typical” sample of the X look like when β = −2?

8. Answer the following questions using results from Example 13.1 andequation (13.14).

a) From the example, calculate a value of β which guarantees thatPNX0=−1|XB=1 < 1/3 for all N > 3.

b) Find a value of β which ensures that the limN→∞ EN [Xs|XB = 1] ≥0.9 for all lattice points s.

c) Does the proof of Example 13.1 hold for a 1-D Ising model? If so,prove the result. If not, explain why?

9. Let X be a binary valued 2-D random field with N ×N points. Assumethat for 0 < i, j ≤ N − 1

PX(0,j) = 0 = PX(i,0) = 0 = 1

2

and for

PX(i,j) = x(i,j)|Xr = xr r < (i, j)= g(x(i,j)|x(i−1,j), x(i,j−1))

=1

3δ(x(i,j), x(i−1,j)) +

1

3δ(x(i,j), x(i,j−1)) +

1

6

a) Compute the complete density function for X.

b) Show that X is an MRF. Give the cliques and the neighborhood forX.

Page 306: Model Based Image Processing (Text)

296 General MRF Models

Page 307: Model Based Image Processing (Text)

Chapter 14

Stochastic Simulation

So far, we have reviewed many non-causal image and signal models, and wehave shown how they can be of great value as prior distributions in inverseproblems such as image restoration and deconvolution. However, we have notyet given any approach for generating samples from these distributions.

The objective of this chapter is to present a general class of techniques forstochastic sampling from complex and high-dimensional distributions. Thesetechniques, which we broadly refer to as stochastic simulation, are based onthe use of Monte Carlo methods for pseudo-random sampling of distributions.While we present stochastic simulation as a method for generating samplesof random objects, the methods can be used to simulate a broad range ofpractical stochastic systems in applications ranging from signal processing,to communications, to chemistry and material science. In addition, thesemethods also serve as a basic tool used in a wide range of techniques includingstochastic optimization, stochastic integration, and stochastic EM parameterestimation.

14.1 Motivation for Simulation Methods

In order to understand the motivation for stochastic simulation methods,consider a situation in which one would like to use a computer to generatea sample of a random variable X with a CDF of F (x) = PX ≤ x. Theclassic approach to this problem is to first generate a pseudo-random numberwhich is uniformly distributed on the interval [0, 1],

U ← Rand([0, 1])

Page 308: Model Based Image Processing (Text)

298 Stochastic Simulation

where Rand([0, 1]) denotes a process for generating such a random variable.Next, one calculates the inverse CDF defined by

F−1(u) , infx|F (x) ≥ u .

Then it can be shown that the desired random variable can be generated byapplying the inverse CDF to the uniform random variable.

X ← F−1(U) (14.1)

In fact, it can be proven that this inverse transform sampling methodworks for any random variable. (See problem 2 of Chapter 2)

With this result, one might think it would be easy enough to generate arandom variable with any desired distribution. However, this is not alwaysthe case. For some distributions, like for example exponential or Gaussianrandom variables,1 it is possible to calculate the inverse CDF in closed form,so that the inverse transform method of equation (14.1) can be directly imple-mented. However, for a general random variable, the inverse CDF typicallydoes not have any simple form; so that direct implementation is not tractable.

For example, consider the random variable, X, with a density functiongiven by

p(x) =1

zexp

−(

4(x− 1)2(x+ 1)2 +x

2

)

. (14.2)

where z is a normalizing constant for the density. In fact, this density hasthe form of a Gibbs distribution, p(x) = 1

ze−u(x), where

u(x) = 4(x− 1)2(x+ 1)2 +x

2.

From Figure 14.1, we can see that both the energy function and its asso-ciated density are bimodal for this distribution, with modes peaking at ap-proximately x = ±1. Not surprisingly, the CDF of this density does nothave closed analytical form, so neither does its inverse. So how might oneefficiently generate samples of this random variable on a computer?

In the following sections, we present a set of tools broadly termed asstochastic simulation methods, that can be used to generate samples from

1 It is interesting to note that the inverse CDF does not have closed form for the Gaussian distribution, butthis problem can be circumvented by generating the distribution of pairs of independent Gaussian randomvariables since their vector norm is exponentially distributed.

Page 309: Model Based Image Processing (Text)

14.2 The Metropolis Sampler 299

−2 −1 0 1 20

1

2Probability Density Function

−2 −1 0 1 20

102030

Energy Function u(x)

Figure 14.1: Example of the energy function and density for a random variable withthe distribution specified in equation (14.2).

general distributions such as the one in equation (14.2). While we motivatethe method with this problem of generating a single random variable, thetechnique has its greatest application in the generation of samples from verycomplex high-dimensional distributions. As a matter of fact, the methodswere first introduced to generate samples from chemical systems in thermo-dynamic equilibrium; so the approaches are quite generally useful.

The first subsection will introduce the Metropolis sampler, perhaps theoriginal example of a stochastic sampling method. Then we will extend thisapproach to the more general Hastings-Metropolis sampler, and finally showthat the very useful Gibbs sampler is in fact a special case.

14.2 The Metropolis Sampler

The Metropolis sampler is a very clever method that allows samples to begenerated from any Boltzmann or equivalently Gibbs distribution [46]. Con-

Page 310: Model Based Image Processing (Text)

300 Stochastic Simulation

sider the discrete distribution on the set Ω with a PMF of the form2

p(x) =1

zexp −u(x) , (14.3)

where u(x) is an energy function and z is the associated partition function.So any strictly positive PMF can be put in this form since it is always possibleto take the energy function as

u(x) = − log p(x) + constant .

In fact, the random quantity X may be a random variable, or it may be ahigher dimensional random object such as a vector or random field.

The objective of a simulation algorithm is to generate a sequence of randomobjects, denoted by X(k), whose distribution converges to the desired Gibbsdistribution, p(x). The strategy of the Metropolis algorithm is to use thecurrent sample, X(k), to generate a “proposal” for a new sample denoted by,W . The proposal, W , is generated randomly, but its distribution is dependenton the current sample, X(k). More specifically, the proposed sample W ischosen from some conditional distribution q(w|X(k)). However, this proposaldensity, q(w|x(k)), must obey the symmetry property that for all w, x ∈ Ω,

q(w|x) = q(x|w) . (14.4)

While the condition of (14.4) is quite restrictive, there are reasonable methodsfor generating proposals that fulfill the condition. For example, we can setthe proposal to be W ← X(k) + Z, where Z is a random variable with asymmetric PDF that is independently generated at each new time k. In thiscase, it is easy to show that the condition applies.

In practice, the proposal W can be generated with the inverse transformsampling method of equation (14.1). In pseudocode, this can be expressed as

U ← Rand([0, 1])

W ← Q−1(U |X(k)) ,

where Q−1(·|x(k)) is the inverse CDF corresponding to the density q(w|x(k)).The proposal density is typically chosen to be relatively simple, so that gen-erating samples from this distribution is easy.

2The theory we develop here assumes discrete random variables, but the methods equally apply to thesampling of continuously valued random variables. In fact, the extension to continuous random variable islargely intuitive since the continuous random variables can be quantized to form discrete ones.

Page 311: Model Based Image Processing (Text)

14.2 The Metropolis Sampler 301

The clever trick of the Metropolis algorithm is then to accept or rejectthese proposals in a very particular way. To do this, we first compute thechange in the energy given by ∆E ← u(W )−u(X(k)). If the change in energyis negative, ∆E < 0, then we immediately accept the proposal, so that

X(k+1) ← W if ∆E < 0 .

However, if the change in energy is positive, ∆E ≥ 0, then we accept theproposal with a probability of e−∆E and reject it with probability 1− e−∆E.In practice, this is done with the following two steps.

U ← Rand([0, 1])

X(k+1) ← W if ∆E ≥ 0 and U < e−∆E

X(k+1) ← X(k) if ∆E ≥ 0 and U ≥ e−∆E .

We can simplify this acceptance decision by introducing a function thatexpresses the acceptance probability for each proposal.

α(w|x(k)) = min

1, e−[u(w)−u(x(k))]

(14.5)

Using this function, the Metropolis sampling is performed in the followingsteps. First, the proposal, W , is generated according to the sampling distri-bution.

U ← Rand([0, 1])

W ← Q−1(U |X(k))

Then the sample is either accepted or rejected according to the acceptanceprobability α(W |X(k)).

U ← Rand([0, 1])

X(k+1) ← W if U < α(W |X(k))

X(k+1) ← X(k) if U ≥ α(W |X(k)) .

Figure 14.2 lays out the Metropolis algorithm in pseudocode format. Theintuition behind the algorithm is that decreases in energy are always ac-cepted but the probability of accepting a proposal with an increasing energydecreases exponentially as the energy increases.

Page 312: Model Based Image Processing (Text)

302 Stochastic Simulation

Metropolis Algorithm:

Initialize X(0)

For k = 0 to K − 1 /*Generate proposal*/

W ∼ q(w|X(k)) /*Use proposal distribution to generate W*/

/*Accept or reject proposal*/

α← min

1, e−[u(W )−u(X(k))]

/*Compute acceptance probability*/

X(k+1) ←

W with probability αX(k) with probability 1− α

Figure 14.2: A pseudocode specification of the Metropolis algorithm for stochasticsimulation from Gibbs distributions.

While this may all seem reasonable, how do we know that the Metropolisalgorithm converges to the desired distribution of equation (14.3)? The proofof convergence depends on a clever use of ergodic theory for Markov chains.First notice that the sequence X(k)Nk=1 is a Markov chain. This is becauseeach new sample, X(k+1), is only dependent on the previous sample, X(k),and other independently generated random variables.

Next, we can show (perhaps surprisingly) that this Markov chain is re-versible as defined in Section 12.4. To see why this is true, consider thetransition probabilities for the Markov chain denoted by p(x(k+1)|x(k)). Witha little thought it is clear that the transition probability is given by

p(x(k+1)|x(k)) =

q(x(k+1)|x(k))α(x(k+1)|x(k)) if x(k+1) 6= x(k)

1−∑

w 6=x(k) q(w|x(k))α(w|x(k)) if x(k+1) = x(k). (14.6)

The justification for this expression is that when x(k+1) 6= x(k), then theprobability of the transition is the product of the probabilities that you willgenerate the proposal multiplied by the probability that you will accept theproposal. Of course, since the transition probabilities must sum to one, theprobability that x(k+1) = x(k) is just one minus the sum of the alternativecases.

In order to show that these transition probabilities are reversible, we mustshow that for all state combinations, (x, x′), the detailed balance equations

Page 313: Model Based Image Processing (Text)

14.2 The Metropolis Sampler 303

of (12.29) hold. For our problem, these are given by

p(x′|x) 1

ze−u(x) = p(x|x′) 1

ze−u(x

′) ,

where p(x) = 1ze−u(x) is the stationary distribution of the ergodic Markov

chain.

To show this, we will consider three cases: case 1 in which u(x′) ≤ u(x)and x′ 6= x; case 2 in which u(x′) > u(x) and x′ 6= x; and case 3 in whichx′ = x. For case 1, we have have that

p(x′|x) = q(x′|x)α(x′|x)= q(x′|x)= q(x|x′)= q(x|x′) e−[u(x)−u(x′)] e[u(x)−u(x

′)]

= q(x|x′) α(x|x′) e[u(x)−u(x′)]

= p(x|x′) e[u(x)−u(x′)] . (14.7)

Rearranging terms and normalizing by the partition function z then providesthe desired result.

p(x′|x) 1

ze−u(x) = p(x|x′) 1

ze−u(x

′) (14.8)

Now there are two additional cases to consider. Case 2 results from swap-ping the roles of x and x′. However, the symmetry of equation (14.8) thenimmediately yields the desired result. For case 3, substituting in x = x′

results in the two sides of equation (14.8) being identical; so the requiredequality holds trivially.

The detailed balance equations of (14.8), then imply the full balance equa-tions hold by simply summing over the variable x.

x∈Ωp(x′|x) 1

ze−u(x) =

1

ze−u(x

′) (14.9)

So we can see that the Gibbs distribution p(x) = 1ze−u(x) is in fact the station-

ary distribution of the Markov chain generated by the Metropolis algorithm.

By Theorem 12.4.1 of Section 12.4, we now know that if the proposaldistribution q(x(k+1)|x(k)) is chosen so that all states can be accessed (i.e.,

Page 314: Model Based Image Processing (Text)

304 Stochastic Simulation

Hastings-Metropolis Algorithm:

Initialize X(0)

For k = 0 to K − 1 /*Generate proposal*/

W ∼ q(w|X(k)) /*Use proposal distribution to generate W*/

/*Accept or reject proposal*/

α← min

1,q(X(k)|W )

q(W |X(k))exp

−[u(W )− u(X(k))]

/*Acceptance prob.*/

X(k+1) ←

W with probability αX(k) with probability 1− α

Figure 14.3: A pseudocode specification of the Hastings-Metropolis algorithm forstochastic simulation from Gibbs distributions. The Hastings-Metropolis algorithmimproves on the more basic Metropolis algorithm by allowing for an asymmetricproposal distribution.

the Markov chain is irreducible), the probability of remaining in the samestate is greater than zero (i.e., the Markov chain is aperiodic), and if thenumber of states are finite, then the Metropolis algorithm must generate anergodic Markov chain that converges to the desired Gibbs distribution.

In this case, we have that

limk→∞

PX(k) = x = 1

zexp−u(x) .

In fact, the Metropolis algorithm is commonly used even when these tech-nical conditions do not hold. For example, it is commonly used to generatesamples from high-dimensional continuous distributions with densities, suchas non-Gaussian MRF models like those discussed in Chapter 6. In fact,much stronger convergence results exist for stochastic simulation methodsand ergodic Markov chains, so our convergence result is simply provided toillustrate the basic concept.

14.3 The Hastings-Metropolis Sampler

While the Metropolis algorithm is a very powerful method, it can be slowto converge to the desired distribution. This is a problem for two important

Page 315: Model Based Image Processing (Text)

14.3 The Hastings-Metropolis Sampler 305

reasons. First, it means that one might need to generate many samples be-fore the ergodic distribution is reached. This time need to run the Markovchain until it approximately converges to its ergodic distribution is some-times referred to as the burn-in time. But a second equally importantconsequence of slow convergence is that it requires more samples to be gen-erated before the random variables Xk become approximately independent.Naive users sometime assume that subsequent samples of the Markov chainare independent, but this is not true. So if the object is to produce inde-pendent stochastic samples from the Markov chain, as is often the case, thena slowly converging Markov chain will require more samples between eachapproximately independent sample.

A crucial limitation in the Metropolis algorithm is the requirement thatthe proposal distribution be symmetric. That is

q(x(k+1)|x(k)) = q(x(k)|x(k+1)) .

Intuitively, it is best if the proposal distribution closely approximates thedesired ergodic distribution. However, this restriction to a symmetric distri-bution is severe because it is often the case that we might want to “bias”the proposals towards ones that more closely match the desired distributionand are therefore more likely to be accepted.3 Intuitively, proposals that arerejected do not lead to any change in the state, so they are substantiallywasted, and one would expect the associated Markov chain’s convergence tobe slowed [33].

Fortunately, Hastings and Peskun discovered a generalization of the Metropo-lis sampler, generally referred to as the Hastings-Metropolis sampler,that allows for the use of proposal distributions that are not symmetric[35, 51]. So in this case, any valid distribution, q(xk|xk−1), can be chosen,but in order to correct for the bias due to this asymmetric proposal density,the probability of acceptance and rejection must be appropriately adjusted.

The acceptance probability for the Hastings-Metropolis sampler is givenby

α(w|x(k)) = min

1,q(x(k)|w)q(w|x(k)) exp

−[u(w)− u(x(k))]

3This strategy is also highly recommended when pursuing funding.

Page 316: Model Based Image Processing (Text)

306 Stochastic Simulation

= min

1,q(x(k)|w)q(w|x(k))

p(w)

p(x(k))

.

So the resulting transition probability is then given by

p(x(k+1)|x(k)) =

q(x(k+1)|x(k))α(x(k+1)|x(k)) if x(k+1) 6= x(k)

1−∑

w 6=x(k) q(w|x(k))α(w|x(k)) if x(k+1) = x(k).

(14.10)

As with the basic Metropolis algorithm, our approach is to prove that theMarkov chain resulting from the Hastings-Metropolis algorithm is reversible.To prove this, we must again show that the Gibbs distribution solves thedetailed balance equation. Our proof is broken into three cases:

Case 1: x′ 6= x and q(x|x′)q(x′|x) exp −[u(x′)− u(x)] ≥ 1;

Case 2: x′ 6= x and q(x|x′)q(x′|x) exp −[u(x′)− u(x)] ≤ 1;

Case 3: x′ = x.

We again start with case 1 for which we have that

p(x′|x) = q(x′|x) α(x′|x)

= q(x′|x)

= q(x|x′) q(x′|x)q(x|x′)

= q(x|x′) q(x′|x)q(x|x′) exp−[u(x)− u(x′)] exp−[u(x′)− u(x)]

= q(x|x′) α(x|x′) exp−[u(x′)− u(x)]

= p(x|x′) exp−[u(x′)− u(x)] , (14.11)

From this we again get the detailed balance equation.

p(x′|x) 1

ze−u(x) = p(x|x′) 1

ze−u(x

′) (14.12)

Once again, case 2 results directly from the symmetry of the of equation (14.12),and case 3 is immediate by substituting x′ = x into equation (14.12).

Page 317: Model Based Image Processing (Text)

14.3 The Hastings-Metropolis Sampler 307

Figure 14.3 presents a pseudocode version of the Hasting-Metropolis al-gorithm. The method is basically the same as for the Metropolis algorithm,

except that the acceptance probability incorporates the ratio q(X(k)|W )q(W |X(k))

.

Another special case arrises when the proposal distribution is exactly thetrue Gibbs distribution. In this case, we have that q(w|x) = p(x), where p(x)is the desired distribution, and then

α(w|x) = min

1,q(x|w)q(w|x)

p(w)

p(x)

= min

1,p(x)

p(w)

p(w)

p(x)

= 1 .

So in this case, the acceptance probability is always 1, and the algorithmconverges to the Gibbs distribution in one step! (See problem 4)

−2 −1 0 1 20

1

2Probability Density Function

−2 −1 0 1 20

1

2Proposal Density Function

0 10 20 30 40 50−2

0

2Metropolis Sample Values

0 10 20 30 40 50−2

0

2Hastings−Metropolis Sample Values

Figure 14.4: Example illustrating the use of the Metropolis and Hastings-Metropolisalgorithms for stochastic sampling of a random variable. (upper left) Plot of thedesired density function of equation (14.13); (upper right) Time sequence of samplevalues generated by the Metropolis algorithm. (lower left) Plot of the proposal densityfunction formed by a mixture of two Gaussians. (lower right) Time sequence ofsample values generated by the Hastings-Metropolis algorithm. Notice that adjacentsamples generated by the Metropolis algorithm are often the same because the updatesare rejected. Alternatively, the proposals of the Hastings-Metropolis are more oftenaccepted, leading to faster convergence of the Markov chain.

Example 14.1. In this example, we use both the Metropolis and Hastings-Metropolis algorithms to generate samples from the distribution

p(x) =1

zexp −u(x) , (14.13)

Page 318: Model Based Image Processing (Text)

308 Stochastic Simulation

whereu(x) = 4(x− 1)2(x+ 1)2 +

x

2.

The upper left hand plot of Figure 14.4 shows a plot of this density function.We will generate proposals, W , for the Metropolis algorithm as

W = X(k) + Z ,

where Z is additive Gaussian noise with Z ∼ N(0, (1/2)2). From this weknow that the proposal distribution has the form

q(w|x(k)) = 1√2πσ2

exp

− 1

2σ2

(

w − x(k))2

,

where σ = 1/2. So therefore, we see that the proposal density has thesymmetry property required for the Metropolis algorithm.

q(w|x(k)) = q(x(k)|w)

The acceptance probability is then given by

α = min

1, exp−[u(w)− u(x(k))]

= min

1,p(w)

p(x(k))

.

The time sequence of values generated by the Metropolis algorithm isshown in the upper right hand plot of Figure 14.4. Notice that sequentialvalues are often exactly the same. This is because many of the samples arerejected. Intuitively, this high rejection rate slows down convergence of theMarkov chain.

Next, we use the Hasting-Metropolis algorithm to generate samples. Forthis algorithm, we are not limited to symmetric proposal densities, so we mayvery roughly approximate the desired distribution of equation (14.13). Wedo this rough approximation with a mixture of two Gaussian distributions,one distributed as N(1, (1/4)2) and a second distributed as N(−1, (1/4)2).This results in a proposal distribution with the form

q(w) =π1

2πσ2w

exp

− 1

2σ2w

(w − 1)2

+π2

2πσ2w

exp

− 1

2σ2w

(w + 1)2

where σw = 1/4, π1 =exp(−1)

1+exp(−1) , and π2 =1

1+exp(−1) . Notice that this density,shown in the lower left corner of Figure 14.4, reasonably approximates the

Page 319: Model Based Image Processing (Text)

14.4 Stochastic Sampling of MRFs 309

true density. So we would expect that fewer rejections will be needed. Forthe Hastings-Metropolis algorithm, the acceptance probability is then

α = min

1,q(x(k))

q(w)

p(w)

p(x(k))

.

So if q(x) ≈ p(x), then the acceptance probability should be ≈ 1.

The plotted time sequence of the Hastings-Metropolis samples shown inFigure 14.4 supports our intuition. Notice that samples are much less corre-lated in time than is the case for the Metropolis algorithm; and in particular,there are many fewer examples of repeated samples (i.e., rejected proposals).This means that the Markov chain converges more quickly to its desired dis-tribution, and that samples become approximately independent with fewertime steps of the Markov chain. In practice, this means that fewer samplesneed to be generated by the Markov chain in order to compute accurateestimates of time averages.

14.4 Stochastic Sampling of MRFs

In the previous sections, we have been a bit vague about exactly what X

represents. In fact, our theory does not assume a specific form for X, butour examples emphasize the case when X is a random variable. While thisscalar case is useful, stochastic simulation is more widely used in applicationswhere X is a high dimensional object, such as an MRF. So in this case, thestimulation method produces samples, X

(k)s , which vary in both 1-D time, k,

and space, s.

While the methods of Sections 14.2 and 14.3 fully apply when X is anMRF, the particulars of the implementation bear some additional scrutiny.More specifically, one needs to consider what practical choices exist for theproposal distribution, q(w|x).

When X is high dimensional, it is common to restrict the proposals tochanges in only one coordinate of the high dimensional vector. So for example,the proposal distribution is restricted to have the form

qs(w|x) = gs(ws|x) δ(wr − xr; r 6= s) , (14.14)

Page 320: Model Based Image Processing (Text)

310 Stochastic Simulation

where gs(ws|x) is the conditional proposal distribution of a single pixel, Ws,given the random field X. The term δ(wr − xr; r 6= s) in the conditionalprobability indicates that all other pixels remain the same. So Wr = Xr forr 6= s. We refer to this strategy of only replacing a single pixel at a time asa coordinate-wise sampler.

Pseudocode for the corresponding coordinate-wise Hastings-Metropolis al-gorithm is listed in Figure 14.5. Notice that the pixels in the MRF are firstordered from 0 to N − 1, and this ordering is denoted by siN−1i=0 . Then ina single full iteration through the image, the pixels are visited and updatedin this repeating sequence. For this case, the acceptance probability is thengiven by

α = min

1,qsi(X

(k)|W )

qsi(W |X(k))exp

−[u(W )− u(X(k))]

(14.15)

= min

1,gsi(X

(k)si |W )

gsi(Wsi|X(k))exp

−[u(W )− u(X(k))]

. (14.16)

Now if the 1-D density function gs(ws|x) > 0 for all ws and x, then on eachupdate it is possible (but perhaps not very likely) to produce any pixel update.And since in one pass through the pixels of X, every pixel is updated, thenin a single update any new image is possible. This means that the resultingMarkov chain is both irreducible and aperiodic Moreover, assuming that theHastings-Metropolis method is used to accept or reject proposals, then theMarkov chain will also be reversible. So we know that with the update ofany pixel, s, the detailed-balance equations must be satisfied; and therefore,the full-balance equations must also be satisfied by the Gibbs distribution.

1

ze−u(x

(k+1)) =∑

x(k)∈ΩN

ps(x(k+1)|x(k)) 1

ze−u(x

(k))

However, the analysis of the previous section assumed that the proposaldistribution, q(x(k+1)|x(k)), is fixed. But in this case, the proposal distributionof equation (14.14) is dependent on s, the pixel being updated. Therefore,the resulting Markov chain is not homogeneous. Since it is not homogeneous,it is also unclear as to whether it converges to the desired Gibbs distribution.

Nonetheless, it seems intuitively clear that if the pixels are updated in afixed and repeated order, then the Markov chain should converge. The fol-lowing argument confirms this intuition. From Property 12.2 of Chapter 12,

Page 321: Model Based Image Processing (Text)

14.4 Stochastic Sampling of MRFs 311

Coordinate-Wise Hastings-Metropolis Algorithm:

Initialize X(0)

Select ordering of pixels, siN−1i=0

Initialize k ← 0

For l = 0 to L− 1 /* Repeat for L full iterations through the MRF */For i = 0 to N − 1

/*Generate proposal*/

W ← X(k) /*Initialize proposal*/

Wsi ∼ gsi(w|X(k)) /*Proposal for sthi pixel*/

/*Accept or reject proposal*/

α← min

1,gsi(X

(k)si |W )

gsi(Wsi |X(k))exp

−[u(W )− u(X(k))]

X(k+1) ←

W with probability αX(k) with probability 1− α

k ← k + 1

Figure 14.5: A pseudocode for a Hastings-Metropolis sampler using coordinate-wiseupdates. The pseudocode performs L complete iterations through the full MRF, andeach full iteration performs a single update of each pixel. The resulting Markov chainis nonhomogeneous, but it still convergences to the desired Gibbs distribution.

we know that the subsampling of any Markov chain produces another Markovchain. So let X(k) be the state after k updates. The subsampled version isthen Y (k) = X(Nk) where N is the number of pixels in the image. ThenY (0) = X(0) is the initial state, Y (1) = X(N) is the state after a single updateof each pixel, and Y (k) = X(Nk) is the result after k full updates of the state.Now Y (k) is a Markov chain because it is formed by a subsampling of X(k).In addition, we know that Y k forms a homogeneous Markov chain becauseeach full update of the pixels follows the same sequence of transition rules.More formally, we can compute the transition probability for Y k as

p(x(N)|x(0)) =∑

x1∈ΩN

x2∈ΩN

· · ·∑

xN−1∈ΩN

N−1∏

i=0

psi(x(i+1)|x(i)) ,

where p(x(N)|x(0)) no longer depends on an index of time. Moreover, since theGibbs distribution is the stationary distribution of the transitions ps(x

(k+1)|x(k)),it must also be the stationary distribution (i.e., solve the full-balance equa-

Page 322: Model Based Image Processing (Text)

312 Stochastic Simulation

tions) for the transition probabilities p(x(N)|x(0)). So we have that

1

ze−u(y

(k+1)) =∑

yk∈ΩN

p(y(k+1)|y(k)) 1

ze−u(y

(k)) .

Finally, if gs(ws|x) > 0 then in one full iteration of the algorithm we can getfrom any state Y (k) to any other state Y (k+1). So therefore, the Markov chainY (k) must be irreducible and aperiodic.

So now we have all the ingredients required for convergence of the ergodicMarkov chain Y (k) to the Gibbs distribution: 1) The Markov chain is sta-tionary; 2) it has a finite state; 3) it is homogeneous; 4) it is irreducible; 5) itis aperiodic; and 6) the Gibbs distribution solves the full-balance equationsof the Markov chain.

With this, we can now state a theorem about the convergence of thecoordinate-wise Hastings-Metropolis sampler.

Theorem 14.4.1. Convergence of Coordinate-Wise Hastings-Metropolis Al-gorithmLet X(k) ∈ ΩN be the kth update of a coordinate-wise Hastings-Metropolisalgorithm sampling from the Gibbs distribution p(x) = 1

ze−u(x) with Ω a finite

discrete set. (See Figure 14.5) Furthermore, assume that the coordinate-wiseproposal distribution is strictly positive, i.e., for all ws ∈ Ω, gs(ws|x) > 0.Then X(k) is a Markov chain, which reaches the stationary distribution

limk→∞

PX(k) = x = 1

ze−u(x) .

This theorem, which is based on the convergence Theorem 12.4.1 of Sec-tion 12.4, ensures that the coordinate-wise Hastings-Metropolis algorithmalways converges to the desired result. However, in some cases, this conver-gence can be very slow.

Moreover, this theorem also guarantees convergence of the basic-Metropolisalgorithm, since that is a special case. Another special case, that is widelyused in practice, is the so-called Gibbs sampler presented in the followingsection.

Page 323: Model Based Image Processing (Text)

14.5 The Gibbs Sampler 313

Gibbs Sampler Algorithm:

Initialize X(0)

Select ordering of pixels, siN−1i=0 /* Can use raster order */

Initialize k ← 0

For l = 0 to L− 1 For i = 0 to N − 1

/*Generate update for sthi pixel*/

X(k+1) ← X(k) /*Initialize update*/

Wsi ∼ gsi(wsi |X(k)∂si

) /* Generate sample from conditional distrib.*/

X(k+1)si ← Wsi /* Replace pixel with generated sample */

k ← k + 1

Figure 14.6: The Gibbs sampler algorithm is a special case of the coordinate-wiseHastings-Metropolis algorithm when the proposal distribution for each pixel is justits conditional distribution given its neighbors, i.e., X

(k+1)s ∼ ps(xs|X(k)

∂s ). In thiscase, the acceptance probability is always α = 1; so all proposals are accepted.

14.5 The Gibbs Sampler

The Gibbs sampler is an important special case of the coordinate-wiseHastings-Metropolis sampler that was first proposed by Geman and Geman[28] and has since become widely used due to its ease of implementation andrelatively fast convergence for simple distributions. With the Gibbs sampler,the proposal distribution is taken to be the conditional distribution of thepixel Xs given its neighbors under the Gibbs distribution.

Assume that X is an MRF4 with a Gibbs distribution of the form

p(x) =1

zexp −u(x)

=1

zexp

−∑

c∈CVc(xc)

,

where u(x) is the energy function and Vc(xc) are the potential functions forclique c. If we again define Cs from equation (13.2) to be the subset of allcliques containing xs, then we know from equation (13.3) that the conditional

4Without loss of generality, X can be assumed to be an MRF because we can always take ∂s = r : r 6= s.

Page 324: Model Based Image Processing (Text)

314 Stochastic Simulation

distribution of a pixel, xs, given all other pixels has the form

PXs = xs|Xr r 6= s =exp −us(xs|x∂s)

xs∈Ω exp −us(xs|x∂s)where

us(xs|x∂s) =∑

c∈CsVc(xc) .

So then for a Gibbs sampler, the key idea is to use the conditional distri-bution of a pixel as the proposal distribution. More specifically, the proposaldistribution is given by

gs(xs|x∂s) = PXs = xs|Xi = xi i 6= s

=exp−us(xs|x∂s)

x′s∈Ω

exp−us(x′s|x∂s).

In this case, the acceptance probability can be computed in closed form tobe

α = min

1,gs(X

(k)s |W∂s)

gs(Ws|X(k)∂s )

exp

−[u(W )− u(X(k))]

= min

1,gs(X

(k)s |W∂s)

gs(Ws|X(k)∂s )

exp

−u(Ws|X(k)∂s )

exp

−u(X(k)s |X(k)

∂s )

= min 1, 1 = 1 . (14.17)

So the acceptance probability for the Gibbs sampler is always 1. Withoutrejections, the algorithm becomes the simple sequential replacement of pixelsfrom their assumed conditional distribution.

For example, with the Ising model of Section 13.3, the conditional distri-bution of a pixel given its neighbors becomes

gs(xs|x∂s) =exp

−β∑

r∈∂s δ(xs 6= xr)

∑M−1xs=0 exp

−β∑

r∈∂s δ(xs 6= xr) . (14.18)

So for this case, the Gibbs sampler would simply replace each pixel in se-quence with a new pixel drawn from this conditional distribution. An impor-tant advantage of the Gibbs sampler is that, since all proposals are accepted,

Page 325: Model Based Image Processing (Text)

14.5 The Gibbs Sampler 315

Test 1

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 10

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 50

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 100

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Test 2

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 10

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 50

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 100

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Test 3

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 10

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 50

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 100

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Test 4

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 10

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 50

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Ising model: Beta = 1.000000, Iteration = 100

2 4 6 8 10 12 14 16

2

4

6

8

10

12

14

16

Uniform Random 10 Iterations 50 Iterations 100 Iterations

Figure 14.7: A Gibbs sampler simulation of a Ising model with inverse temperatureparameter of β = 1.0 for a 16 × 16 binary array using circular boundary conditions.Each row represents an independently run experiment using a different seed for thepseudo-random number generator, and the columns are the results after 0, 10, 50, and100 full iterations through the image. Notice that after a large number of iterations,the result becomes either mostly all 1’s or mostly all −1’s because β is above thecritical value.

it tends to achieve faster convergence. Intuitively, each pixel is replaced witha sample having the desired distribution. So it is quite reasonable that re-peated updating of pixels with this “correct” distribution should converge tothe entire random field having the correct distribution.

Figure 14.7 shows the results of an example in which a Gibbs sampler isused to generate pseudo-random samples from the distribution of a 16 × 16Ising model with circular boundary conditions and an inverse temperature

Page 326: Model Based Image Processing (Text)

316 Stochastic Simulation

parameter of β = 1.0. So this example corresponds to the conditional distri-bution of equation (14.18), but with a 4-point neighborhood and M = 2. Thefigure shows 4 independent runs of the simulation, each with an independentinitial condition of i.i.d. binary random variables with equal probability of1 (white) and −1 (black). The columns are the results after 0, 10, 50, and100 full iterations through the image. Notice that after a large number ofiterations, the result becomes either mostly all 1’s or mostly all −1′s. Thishappens because β is above the critical value; so we know that the distribu-tion of the Ising model is bi-modally disturbed, with one mode consisting ofmostly all 1’s, and the other mode consisting of mostly all −1’s.

For this example, the Gibbs sampler does a good job of generating rep-resentative samples from the distribution of the Ising model, but as the sizeof the image grows larger, or as the value of β grows larger, one can eas-ily imagine that the Gibbs sampler can become “trapped” in a deep localmaximum of the distribution. In fact, while the Gibbs sampler is guaranteedto converge, in many practical cases its convergence can be extremely slow.In some cases, the convergence is so slow that no practical computer couldgenerate the desired result. We will look at this issue in more depth in thefollowing chapter.

Page 327: Model Based Image Processing (Text)

14.6 Chapter Problems 317

14.6 Chapter Problems

1. Let W = Xk + Z where Z is independent of Xk with density pz(z).Show that the proposal density q(w|x) obeys the symmetry condition ofequation (14.4).

2. The following problem verifies some properties of the Metropolis simu-lation algorithm.

a) Show that the transition probabilities for the Metropolis algorithmgiven by equation (14.6) are correct.

b) Justify each line in the proof of equation (14.7).

c) Use the symmetry of equation (14.8) to show that it also holds incase 2 when u(x′) > u(x) and x′ 6= x.

d) Show that equation (14.8) also holds in case 3 when x′ = x.

3. Justify each line in the proof of equation (14.11). Then prove the resultof equation (14.12) using the three cases given in the text.

4. Show that when the proposal distribution is taken to be

q(w|xk) = 1

zexp−u(w) ,

then the acceptance probability is 1, and the algorithm converges to theGibbs distribution in one step.

5. Consider the random variable X with density

p(x) =1

σz(p)exp

− 1

pσp|x|p

,

with p = 1.2 and σ = 1. Consider the case of a Metropolis simulationalgorithm for sampling from the distribution of p(x) with the proposalsgenerated as W ← Xk + Z where Z ∼ N(0, 1).

a) Plot the density function for p(x).

b) Show that the proposal distribution obeys the symmetry condition ofequation (14.4) and derive an expression for the acceptance probabilityα.

c) Write a Matlab program to generate 100 Metropolis samples from aninitial condition of X0 = 0, and plot your output.

Page 328: Model Based Image Processing (Text)

318 Stochastic Simulation

6. Consider the positive random variable X with density

p(x) =1

σz(p)exp

− 1

pσp|x|p

,

with p = 1.2 and σ = 1. Consider the case of a Hastings-Metropolissimulation algorithm for sampling from the distribution of p(x) with theproposals generated as W ∼ q(w) where

q(w) =1

2γexp

−1

γ|w|

,

where γ = 1.

a) Plot the density function for p(x) and the proposal density q(w). Howdo they compare?

b) Derive an expression for the acceptance probability α.

c) Write a Matlab program to generate 100 Hastings-Metropolis samplesfrom an initial condition of X0 = 0, and plot your results.

d) Compare your results to the results of Problem 5 above.

Page 329: Model Based Image Processing (Text)

Chapter 15

Bayesian Segmentation

Up until this point, our primary focus has been on the use of MRF priors inapplications where the unknown image, X, is continuously valued. A partialexception in Chapter 12 was the estimation of discrete Markov chain statesusing a doubly-stochastic hidden Markov model.

In this chapter, we study the application of model-based methods to theestimation of discrete random-fields, X, from observation data. In manyapplications, this is essentially equivalent to segmentation of an image, withthe discrete state of each pixel in X representing a class of the segmentation.To do this, we will use the tools introduced in Chapter 13 to model generaldiscrete MRFs along with the computational techniques of Chapter 14 tocompute estimates of the discrete image X.

An important point to remember is that the methods of this chapter notonly apply to the traditional segmentation of images. They also can beapplied to the reconstruction of images when the images have discrete prop-erties. This is extremely important when imaging 3-D objects composed of asmall number of discrete materials since the segmentation into these discreteregions can be a powerful constraint.

15.1 Framework for Bayesian Segmentation

Figure 15.1 graphically illustrates the basic framework for MAP segmentationof an image. The unknown segmentation is represented by X, a random fieldtaking on discrete values Xs ∈ Ω = 0, · · · ,M − 1 for s ∈ S. Each classis denoted by a discrete value 0 through M − 1, and each pixel is assumed

Page 330: Model Based Image Processing (Text)

320 Bayesian Segmentation

1

2

3

0

Y - Texture feature vectors observed from image.

X - Unobserved field containingthe class of each pixel

Figure 15.1: Diagram illustrating the forward model used for segmentation of animage. Each class corresponds to a different local statistical behavior in the im-age. Segmentation can then be perform through MAP estimation of the unobservedrandom field X.

to take on one of these M discrete classes. Typically, the random field ofclasses, X, is assumed to be a discrete MRF with a Gibbs distribution ofform in equation (13.1). Then by estimating X, we then recover the unknownsegmentation of the observed image Y .

Our estimate of X is based on the observed data Y , through a forwardmodel, p(y|x) = PY ∈ dy|X = x, and a prior model, p(x) = PX = x.In a typical case, p(x) is a Gibbs distribution for a discrete MRF, and p(y|x)is formed by a local dependency of each observed pixel Ys on its unknownclass, Xs. So for example, if each observed pixel, Ys, is only dependent on itsassociated class label, Xs, then we have

py|x(y|x) =∏

s∈Spys|xs

(ys|xs) (15.1)

where pys|xs(ys|xs) is the conditional distribution of Ys given Xs. In this case,

we say that the likelihood has product form, and the negative log likelihoodused in MAP estimation can be written as a sum of independent terms,

− log py|x(y|x) =∑

s∈Sl(ys|xs) , (15.2)

where l(ys|xs) = − log pys|xs(ys|xs).

While assuming this type of product from can be extremely useful, it isalso a strong assumption because it presumes that neighboring pixels areconditionally independent given the class labels X. In natural images, there

Page 331: Model Based Image Processing (Text)

15.1 Framework for Bayesian Segmentation 321

are usually spatial correlations between nearby pixels of the same class; sothis type of model does not account for such spatial dependencies. A partialsolution to this problem is to let each observed pixel, Ys, be an local featurevector extracted from the image. Of course, this is also approximate sinceneighboring feature vectors will likely share information and be conditionallydependent, but nonetheless, the approach can be effective.

The form of equation (15.1) allows for a wide range of choices in thedistribution of pys|xs

(ys|xs). Just about any distribution parameterized by φ

can be used. In this case, each of the M classes can be specified by a differentchoice of the parameter φmM−1m=0 , and the negative log likelihood is given by

l(ys|xs) = − log pys|xs(ys|φxs

) .

For example, if each class is assumed to be conditionally Gaussian, then

l(ys|xs) =1

2σ2xs

(ys − µxs)2 +

1

2log(

2πσ2xs

)

,

and each pixel Ys is a conditionally independent Gaussian random variablewith mean µxs

and variance σ2xs.

Another common choice is to assume that each pixel Ys is conditionallydistributed with a Gaussian mixture from Section 11.2. This has the advan-tage that each of the M Gaussian mixture distributions can be fitted to theempirical distribution of each class. Of course, the parameters of a Gaussianmixture can be fitted using ML estimation with the EM algorithm of Sec-tion 11.4. In this case, each parameter vector φm parameterizes the Gaussianmixture distribution of the M th class.

More specifically, we can model Ys as a p-dimensional Gaussian mixturegiven the class label Xs. The parameters of this model can be estimatedusing the EM algorithm as described in Section 11.7.3. So we have that fora J component Gaussian mixture, the parameter to be estimated is

φm = πm,j, µm,j, Bm,jJ−1j=0 ,

where πm,jJ−1j=0 are the J component weightings that sum to 1, µm,jJ−1j=0

are the component means, and Bm,jJ−1j=0 are the component precision (i.e.,inverse covariance) matrices. Then the conditional distribution of Ys given

Page 332: Model Based Image Processing (Text)

322 Bayesian Segmentation

Xs is

pys|xs(ys|m,φ) =

J−1∑

j=0

πm,j|Bm,j|1/2(2π)p/2

exp

−12(ys − µm,j)

tBm,j(ys − µm,j)

,

(15.3)and the negative log likelihood is given by

l(ys|m,φ) = (15.4)

− log

(

J−1∑

j=0

πm,j|Bm,j|1/2(2π)p/2

exp

−12(ys − µm,j)

tBm,j(ys − µm,j)

)

.

Once forward and prior models have been chosen, we can apply sometype of Bayesian estimator to determine X from Y . The general approach,described in Section (2.3.2), is to select a cost function, C(x, x), and thenchoose the estimator X = T (Y ) that minimizes the expected cost.

T ∗ = argminT

E[C(X, T (Y )]

If the cost is chosen to be C(x, x) = 1− δ(x− x), then the optimal estimatoris the MAP estimate given by

X = T ∗(Y )

= arg maxx∈ΩN

px|y(x|Y )

= arg minx∈ΩN

− log py|x(Y |x)− log p(x)

. (15.5)

However, the cost function of the MAP estimate is difficult to justify sinceit is only 0 when there is an exact match between the true segmentationX and the estimate X. This is a very conservative criteria since it meansthat having one erroneous pixel classification is no worse then having everypixel wrong. Nonetheless, the MAP estimate is widely used because it can beimplemented with numerical optimization, and it often yields good results.

A more compelling cost criteria actually counts the number of classificationerrors in the image, rather than simply checking to see if the classification isperfect. This cost function is given by

C(x,X) =∑

s∈Sδ(xs 6= Xs) ,

Page 333: Model Based Image Processing (Text)

15.1 Framework for Bayesian Segmentation 323

and minimization of this cost function results in the so-called maximizer ofthe posterior marginals (MPM) estimator [45] given by

Xs = argmaxxs

pxs|Y (xs|Y ) . (15.6)

This MPM estimator has the property that it minimizes the number of mis-classified pixels in the image, which is quite reasonable in most applications,but it has the disadvantage that it requires the computation of an (N − 1)-dimensional integral or expectation.

Xs = argmaxxs

E[

py|x(Y |xs, Xr r 6= s)p(xs, Xr r 6= s)|Y]

(15.7)

While computing this high-dimensional integral for each pixel might seemimpossible, it can be done using the stochastic sampling techniques of Chap-ter 14 as we will describe in Section 15.1.2.

In the following sections, we will introduce some of the methodologies forcomputing Bayesian estimates of discrete random fields, X, with a structureas shown in Figure 15.1. In particular, we will present basic methods forcomputing both the MAP and MPM estimates of equations (15.5) and (15.7).

15.1.1 Discrete Optimization for MAP Segmentation

In order to illustrate basic methods for optimization of the MAP cost func-tion, we start by assuming that the image has a log likelihood with a product-form as in equation (15.1) and a prior model based on an M-level discreteMRF. Then the negative log likelihood is given by

− log py|x(y|x) = −∑

s∈Slog pys|xs

(ys|xs)

=∑

s∈Sl(ys|xs) ,

where l(ys|xs) = − log pys|xs(ys|xs) is the negative log likelihood for each pixel,

and the negative log prior term is given by

− log p(x) = β∑

s,r∈Cδ(xr 6= xs) + constant ,

Page 334: Model Based Image Processing (Text)

324 Bayesian Segmentation

where C contains all pairwise cliques in an 8-point neighborhood. Using thesetwo models, the MAP estimate is given by

x = arg minx∈ΩN

− log py|x(y|x)− log p(x)

= arg minx∈ΩN

s∈Sl(ys|xs) + β

s,r∈Cδ(xr 6= xs)

. (15.8)

In general, optimization problems with the form of equation (15.8) are verydifficult to solve. Since they are discrete, they certainly can not be convex.In fact, even the definition of convexity no longer applies since it requiresthe function to be defined along any line connecting two inputs values to thefunction, and a linear combination of two discrete variables is not necessarilydiscrete.

In general this optimization problem will have exponential complexity.However, in the special case when M = 2, this type of optimization can besolved exactly in polynomial time by using graph cut algorithms based onthe max-flow min-cut theorem [34]. This class of graph cut algorithms canbe solved in polynomial time by the Ford-Fulkerson algorithm [22]. Infact, this approach works for any problem with the form of equation (15.8)whenM = 2. Moreover, it even holds when the neighborhoods have arbitrarystructure and the weights of the potential function are space varying. So forexample, it works for binary segmentation using the M -level discrete MRFof equation (13.17) with M = 2.

However, the exact graph-cut solution does not work when M > 2, and itgenerally only works when the log likelihood of the data has a simple productform of equation (15.1). In particular, the product form is often not a realisticassumption when pixels are conditionally dependent or depend on the classlabel of nearby pixels. Nonetheless, graph-cut algorithms have become verypopular in image segmentation, so these can be a very useful technique [16].

So absent an exact algorithm for minimization of equation (15.8), we mustresort to some approximate method of minimization. Early on, there weremany attempts to use dynamic programming to solve this MAP segmentationproblem in much the same way that dynamic programming can be used tosolve the MAP estimation problem for HMMs. However, dynamic program-ming does not work in 2-D because the state variable must have the dimension

Page 335: Model Based Image Processing (Text)

15.1 Framework for Bayesian Segmentation 325

of an entire row or column of the image, which makes the complexity expo-nential. Nonetheless, various approximation methods have been proposed fordoing approximate MAP segmentation by, for example, processing a smallnumber of image rows at a time [18, 68].

Perhaps the most common approach to minimization of this cost functionis coordinate-wise optimization similar to ICD. For discrete random fields, X,this approach is often called iterated conditional modes (ICM) [8]. ICMworks by iteratively replacing each pixel’s class with the class that maximizesthe mode of the conditional distribution p(xs|y, xr r 6= x). This can becomputed as

xs ← argmaxxs

p(xs|y, xr r 6= s)

= argminxs

− log py|x(y|xs, xr r 6= s)− log p(xs, xr r 6= s)

= argminxs

l(ys|xs)− log p(xs, xr r 6= s)

= argminxs

l(ys|xs) + β∑

i,j∈Cδ(xi 6= xj)

= argminxs

l(ys|xs) + β∑

r∈∂sδ(xs 6= xr)

.

So with this, we see that replacing each pixel with its conditional mode isexactly equivalent to performing an ICD update, i.e., sequentially replacingeach pixel with the value that maximizes the MAP cost function. So ICDand ICM are equivalent for discrete random fields, X.

Figure 15.2 provides a pseudocode specification of the ICM algorithm. Thesegmentation is initialized with the ML estimate of the class of each pixel.This is simply the class that maximizes the likelihood for each observation Ys.Then for each iteration of the algorithm, every pixel is visited and replacedwith the class that maximizes the MAP cost function. This can be done withlittle computation since each pixel is only dependent on the local negativelog likelihood, l(ys|xs), and the class of its neighbors. Each pixel replacementmonotonically decreases the MAP cost function, and the MAP cost function isbounded below, so this sequence is guaranteed to converge to a local minimumof the cost function in a finite number of steps. When this happens, each

Page 336: Model Based Image Processing (Text)

326 Bayesian Segmentation

new pixel replacement remains the same,1 and the iterations stop. However,while ICM can be a simple and effective algorithm for MAP segmentation,it does have the problem that it is easily trapped in local minimum of theMAP cost function, particularly when the signal-to-noise ratio is low.

ICM Algorithm:

Initialize with ML estimate xs ← argmin0≤m<M l(ys|m)

Repeat until no changes occur For each pixel s ∈ S

xs ← arg min0≤m<M

l(yr|m) + β∑

r∈∂s

δ(m 6= xr)

Figure 15.2: A pseudocode specification of the ICD algorithm for computing anapproximate MAP estimate of a discrete random field X. This algorithm is typicallyused to segment images from observed data Y .

One approach to avoiding local minima in optimization is simulated an-nealing (SA). The concept of SA is to use the stochastic sampling methodsof Chapter 14 to generate samples from a distribution whose maximum alsominimizes the MAP cost function. So for our problem, the MAP cost functionis given by

u(x) =

s∈Sl(ys|xs) + β

s,r∈Cδ(xr 6= xs)

, (15.9)

where we use the notation u(x) in order to draw an analogy with the energy ofa Gibbs distribution. In fact, it is easily shown that the posterior distributionof the segmentation, px|y(x|y), is given by the following Gibbs distribution

pT (x|y) =1

zexp

− 1

T u(x)

,

when the temperature T = 1. However, as the temperature is reduce so thatT ≤ 1, samples from this distribution become more concentrated about theMAP estimate of X.

1An interesting dilemma occurs when the M possible values of the cost functions are equal for a pixelreplacement. If the tie-breaking algorithm is deterministic, then convergence of ICM is guaranteed. However,if the tie-breaking algorithm is, for example, stochastic, then it is possible to have limit-cycles that do notallow convergence of the state, x. In this case, the pixel choices can cycle between states that have equalvalues of the MAP cost function. One such tie-breaking procedure that guarantees convergence is to onlychange the current pixel value when the new class strictly decreases the MAP cost function.

Page 337: Model Based Image Processing (Text)

15.1 Framework for Bayesian Segmentation 327

To better illustrate this point, consider the MAP estimate

x = arg minx∈ΩN

u(x) ,

and let x 6= x be any other value of x.2 Then we can see that as the temper-ature goes to zero, the likelihood ratio between the probability of the MAPestimate and any other state goes to infinitely.

limT ↓0

pT (x)

pT (x)= lim

T ↓0exp

1

T (u(x)− u(x))

= limT ↓0

exp

1

T

(

u(x)−minx∈Ω

u(x)

)

= ∞

Moreover, since pT (xMAP ) ≤ 1, we then know that for x 6= x then

limT ↓0

pT (x) = 0 .

So if the MAP estimate, x, is unique, then

limT ↓0

pT (x) = 1 .

In other words, as the temperature goes to zero, any stochastic sample fromthe distribution pT (x) will be the MAP estimate with probability one.

So the solution might seem simple. Just set the temperature, T , to somevery small value, and use the stochastic sampling methods of Chapter 14to generate a sample from the distribution pT (x) using, say, the Metropolis-Hastings sampler or perhaps the Gibbs sampler. However, the problem withthis approach is that as the temperature becomes small, the convergence ofthe Metropolis-Hastings algorithm becomes very, very slow. This is becausethe probably of transitioning between some states in the MC becomes verysmall, effectively violating the assumption of irreducibility for the reversibleMC. That is to say, that when T is very small, then it become very improbableto transition between some states, so the MC is, for all practical purposes,no longer irreducible; and therefore, it is no longer ergodic.

The partial solution to this problem is to start the temperature, T , at alarge value, and then allow its value to decrease slowly as samples from the

2Here we are assuming that x represents an equivalence class of states that all minimize the MAP costfunction.

Page 338: Model Based Image Processing (Text)

328 Bayesian Segmentation

Metropolis-Hastings algorithm are generated. This means that the resultingMC is no longer homogeneous. Nonetheless, it is still possible to show con-vergence of this nonhomogeneous MC to the MAP estimate, x, under theproper conditions.

In practice, the Gibbs sampler is typically used in this application sincethen there is no need to do rejections. Now in order to implement the Gibbssampler, we must compute the conditional distribution of each pixel given allthe other pixels in the image. For the distribution, pT (x), it is easily shownthat this conditional distribution is given by

pT (xs|y, xr r 6= s) =1

zexp

1

T u(xs|xr r 6= s)

=exp

1T u(xs|xr r 6= s)

∑M−1m=0 exp

1T u(m|xr r 6= s)

, (15.10)

whereu(xs|xr r 6= s) = l(ys|xs) + β

r∈∂sδ(xr 6= xs) .

The SA algorithm is then shown in Figure 15.3. First a annealing sched-ule denoted by Tk is chosen to be a decreasing sequence of temperatures. Ineach iteration of the algorithm, each pixel is replaced by a new independentrandom variable with a distribution take from equation (15.10). As the tem-perature decreases, samples from the distribution should become clusteredmore closely to the MAP estimate, x. However, if the temperature decreasestoo quickly, then one might expect that the MC will not achieve its desiredstationary distribution at each temperature and convergence will not occur.

Figure 15.4 illustrates the value of SA for a simple example. The toprow shows the result of different numbers of full iterations of ICD, and thebottom row shows the same thing for the SA algorithm. Notice that the SAresult is better because it does not become trapped in a local minimum of thecost function. This can often happen when the two classes have very similardistributions, as is the case in this example.

So the question remains, what annealing schedule, if any, ensures conver-gence of the SA algorithm to the MAP estimate? In fact, this question wasanswered by Geman and Geman in their classic paper [28]; however, the an-swer is perhaps still unsatisfying. Let N be the number of pixels in X, and

Page 339: Model Based Image Processing (Text)

15.1 Framework for Bayesian Segmentation 329

SA Algorithm:

Initialize with ML estimate xs ← argmin0≤m<M l(ys|m)

Select an annealing schedule: Decreasing sequence Tk

For k = 1 to ∞ For each pixel s ∈ S

Compute the conditional energy

u(xs|xr r 6= s) = l(ys|xs) + β∑

r∈∂s

δ(xr 6= xs)

Generate a new pixel

xs ∼exp

1Tku(xs|xr r 6= s)

∑M−1m=0 exp

1Tku(m|xr r 6= s)

Figure 15.3: A pseudocode specification of the SA algorithm for computing an ap-proximate MAP estimate of a discrete random field X. The SA algorithm has theadvantage that it can avoid local minima in the MAP cost function, but at the costof often substantial additional computation.

define ∆ = maxx u(x)−minx u(x). Then an annealing schedule with the form

Tk =N∆

log(k + 1),

produces an sequence of Gibbs samples X(k) that converge to the MAP es-timate x almost surely [28]. However, the problem is that this annealingschedule is absurdly slow. In fact, for this reason has been said that “SAminimization is only slightly worse than exhaustive search.”3 For example,if N = 10,000 and ∆ = 1, then in order to achieve a temperature of Tk = 1corresponding to simply sampling form the posterior distribution requires anumber of simulation steps of k ≥ e10,000− 1. This is completely impractical!

So in practice, people use SA but with much faster annealing schedulesthat allow for some type of reasonable tradeoff between speed and accuracy.For example, a more typical annealing schedule that achieves a reasonable

3This insightful statement was reported to have been made by Allan Willsky.

Page 340: Model Based Image Processing (Text)

330 Bayesian Segmentation

5 10 15 20 25 30

5

10

15

20

25

30

5 10 15 20 25 30

5

10

15

20

25

30

5 10 15 20 25 30

5

10

15

20

25

30

5 10 15 20 25 30

5

10

15

20

25

30

5 10 15 20 25 30

5

10

15

20

25

30

Iterated Conditional Modes (ICM): Original; ML ; ICM 1; ICM 5; ICM 10

5 10 15 20 25 30

5

10

15

20

25

30

5 10 15 20 25 30

5

10

15

20

25

30

5 10 15 20 25 30

5

10

15

20

25

30

5 10 15 20 25 30

5

10

15

20

25

30

5 10 15 20 25 30

5

10

15

20

25

30

Simulated Annealing (SA): Original; ML ; SA 1; SA 5; SA 10

Figure 15.4: Figure comparing the results of MAP segmentation using ICD andsimulated annealing. In this example, the two classes are composed white Gaussiannoise with slightly different means. Notice that the ICM algorithm becomes trappedin a local minimum of the cost function, whereas the simulated annealing algorithmdoes not. In this case, the background and foreground classes are generated withGaussian distributions N(117, 322) and N(137, 322) respectively.

approximate solution is given by

Tk = T0(TKT0

)k/K

,

where TK is the selected temperature after K iterations and T0 is the initialtemperature.

15.1.2 Stochastic Integration for MPM Segmentation

As we discussed in Section 15.1.1, the MPM estimate of a discrete randomfield can be superior to the MAP estimate because it actually minimizes theprobability of error in the estimated segmentation. However, the drawbackof the MPM estimate is the potentially high cost of computation. Morespecifically, the MPM estimate requires that we compute the conditionaldistribution of a pixel, Xs, given all the data Y ; and this, in turn, requiresintegration over the N−1 variables, Xr for r 6= s. Of course, exact integrationis not possible for any practical value of N ; but in the following section, we

Page 341: Model Based Image Processing (Text)

15.1 Framework for Bayesian Segmentation 331

will see that it is often possible to get a sufficiently accurate approximationto this integral by using the simulated annealing approach of the previoussection.

To do this, we first generate a set of L discrete images, each generatedfrom the conditional posterior distribution, px|y(x|Y ). So more specifically,let X(l) ∼ px|y(x|Y ) for l = 0, · · ·L−1 be a set of L images each sampled fromthe posterior distribution px|y(x|Y ). Then define the normalized histogramfor the pixel Xs as

hs(xs) =1

L

L−1∑

l=0

δ(

X(l)s − xs

)

.

Then hs(xs) is essentially an empirical estimate of the conditional distributionof Xs given Y . In particular, we also know that the conditional mean of eachentry in the sum is given by

E

[

δ(

X(l)s − xs

)

|Y]

= pxs|y(xs|Y ) .

Then using the law of large numbers, we know that the following sequenceof equalities hold,

limL→∞

hs(xs) = limL→∞

1

L

L−1∑

l=0

δ(

X(l)s − xs

)

a.s.= E

[

δ(

X(l)s − xs

)

|Y]

= pxs|y(xs|Y ) ,

where the second equality results from the strong law of large numbers andthe fact that the sample images, X(l), are assumed to be independent samplesfrom the posterior distribution.

So with this, we can use this empirical estimate of the posterior to computean approximate MPM estimate of X as

xs = argmaxxs

pxs|y(xs|Y )

≈ argmaxxs

hs(xs) .

In practice, to do this one need only generate L samples of the posteriorimage, and then for each pixel, create a histogram, and select the class thatmaximizes the histogram.

Page 342: Model Based Image Processing (Text)

332 Bayesian Segmentation

So in order to generate the samples from the posterior, we can again usethe stochastic sampling algorithms of Chapter 14 to generate the imagesX(l). To do this, we adopt the energy function corresponding to the MAPcost function of equation (15.9).

u(x) = − log p(y|x)− log p(x) + constant

=∑

s∈Sl(ys|xs) + β

s,r∈Cδ(xr 6= xs)

Then we sample from the Gibbs distribution

pT (x|y) =1

zexp

− 1

T u(x)

,

with a temperature of T = 1. In fact, when T = 1, the Gibbs distribution isexactly equal to the posterior distribution px|y(x|y), and samples generatedusing the Hastings-Metropolis algorithm will be approximately independentsamples from the posterior distribution. Of course, this assumption of in-dependent samples from the posterior distribution in turn depends on theassumption that the MC is run long enough to achieve its steady-state er-godic distribution. So in practice, there is a tradeoff between speed andaccuracy in the MPM algorithm.

Figure 15.5 provides a pseudocode specification of the MPM algorithm. Asthe number of samples, L, is increased, the accuracy of the method improves,but at the cost of additional computation. Also, each sample, X(l), is assumedto be an independent sample from the posterior distribution. In order toensure this, the number of stochastic samples used in the Hastings-Metropolisalgorithm must be increased. So, generally speaking, the MPM algorithmcan be computationally expensive to implement, but it can also achieve highquality segmentations.

15.1.3 Multiscale Approaches to MAP Segmentation

The SA method is useful for experimentation, but in practice, it is usuallynecessary to have a faster algorithm in real applications. One approach thatis often useful for speeding optimization are multiscale methods and multigridmethods.

Page 343: Model Based Image Processing (Text)

15.1 Framework for Bayesian Segmentation 333

Stochastic MPM Algorithm:

/* Generate L samples from the posterior distribution */For l = 1 to L− 1

Generate a stochastic sample from the distribution

X(l) ∼ 1

zexp −u(x)

where u(x) =∑

s∈S

l(ys|xs) + β∑

s,r∈C

δ(xr 6= xs)

/* Compute MPM estimate for each pixel */For each pixel s ∈ S

Compute the conditional histogram

hs(xs) =1

L

L−1∑

l=0

δ(

X(l)s − xs

)

.

Compute approximate MPM estimate

xs ← argmaxxs

hs(xs)

Figure 15.5: A pseudocode specification of the stochastic MPM algorithm. Thestochastic sampling methods of Chapter 14 are used to generate samples from theposterior distribution. Then these samples are used to estimate the posterior distri-bution of each pixel, and the maximum of the histogram is selected.

Below we illustrate a simple but effective multiscale method for solving theMAP segmentation problem [12]. Other more sophisticated approach can beformulated by extending the MRF model to a third dimension [41].

t =2t =1

(0)

1

(0)x x(1)

2

1

1 1

0

1(1)

(1)

11

1 1

1 1 1 1

1 1 1 1

0 0

00

2t =5(0)

t =4

Image Image

(a) (b)

Figure 15.6: Figure (a) depicts a quad tree structure for an image, and (b) shows thethe relationship between fine and course scale pixel pairs of different class.

Page 344: Model Based Image Processing (Text)

334 Bayesian Segmentation

Consider the somewhat more general MAP cost function with the form

u(x) =∑

s∈Sl(ys|xs) + β1t1(x) + β2t2(x) ,

where t1(x) and t2(x) count the number of horizontal-vertical and diagonalpixel pairs, respectively. This just the same as using the M -level discreteMRF of equation (13.17) as a prior model. So our strategy is to first computethe MAP estimate under the assumption that the segmentation is constanton blocks of size 2l × 2l. Then we repeat with smaller blocks until we reacha block size of 20 = 1 at the finest resolution. At each level, we initializethe MAP segmentation process with an interpolated version of the previouslower resolution MAP estimate. Since each MAP optimization is initializedwith a good first guess, the convergence is rapid and tends to avoid localminimum. So the entire coarse-to-fine process is typically fast and results ina good quality segmentation.

More specifically, we can adopt a quad-tree structure as shown in Fig-ure 15.6(a). So the finest resolution is denoted by l = 0 and the coarsest byl = L− 1. At each resolution, a single pixel represents a block of size 2l × 2l

at the finest scale. If we assume that each entire block has a single class, thenthe associated negative log likelihood function at scale l and pixel s is givenby

l(k)s (m) =∑

r∈d(s)l(k−1)r (m) ,

where d(s) denotes the four children of s, and this fine-to-coarse recursion is

initialized with l(0)s (m) = l(ys|m) at the finest scale. In fact, implementing

this recursion at all scales is quite efficient requiring only O(N) operations.

We can also define corresponding course scale statistics, t(l)1 and t

(l)2 , that

count the number of fine scale pixel pairs of differing type that result from thiscourse scale segmentation. If we assume that the segmentation is constanton blocks, as is the case if the segmentation is performance at scale l, thenthe values of t

(l)1 and t

(l)2 at each scale are related by the following recursion.

t(l−1)1 = 2t

(l)1 (15.11)

t(l−1)2 = 2t

(l)1 + t

(l)2 (15.12)

To see why this is true, consider Figure 15.6(b). Notice that for each adjacentblock of different class at scale l, there are 2 adjacent blocks at scale l− 1 of

Page 345: Model Based Image Processing (Text)

15.1 Framework for Bayesian Segmentation 335

MRS Algorithm:

Select coarsest scale L and parameters β(l)1 and β

(l)2

Set l(0)s (m)← l(ys|m).

For l = 1 to L, compute: l(l)s (m) =

r∈d(s) l(l−1)r (m)

Compute ML estimate at scale L: x(L)s ← argmin0≤m<M l

(L)s (m)

For l = L to 0 Perform ICM optimization using inital condition x

(L)s until

converged

x(l) ← argminx(l)s

s

l(l)s (x(l)s ) + β

(l)2 t

(l)1 + β

(l)2 t

(l)2

if l > 0 compute initial condition using block replication

x(l−1) ← Block Replication(x(l))

Output x(0)

Figure 15.7: A pseudocode specification of the multiresolution segmentation (MRS)algorithm for computing an approximate MAP estimate of a discrete random field X.Multiresolution algorithms can often avoid local minima in the MAP cost functionand are computationally efficient.

different class, and 2 diagonal blocks at scale l−1 of different class. Also, foreach diagonal block of different class at scale l, there is only 1 diagonal blockat scale l − 1 of different class. Summing terms results in equations (15.11)and (15.12). In matrix form, this can be expressed as

[

t(l−1)1

t(l−1)2

]

=

[

2 02 1

]

[

t(l)1

t(l)2

]

. (15.13)

In order for the optimization problem to be consistent at different scales, thevalues of the energy functions at scales l and l−1 should be equal. Formally,this means that the following equality must hold.

[

β(l−1)1 β

(l−1)1

]

[

t(l−1)1

t(l−1)2

]

=[

β(l)1 β

(l)1

]

[

t(l)1

t(l)2

]

(15.14)

Page 346: Model Based Image Processing (Text)

336 Bayesian Segmentation

Then substituting in equation 15.13 into equation 15.14, results a recursionbetween the parameters, β, at scale l − 1 and l.

[

β(l)1

β(l)2

]

=

[

2 20 1

]

[

β(l−1)1

β(l−1)2

]

. (15.15)

So the parameters β(0) can be chosen at the finest scale, and then the recur-sion of equation (15.15) can be used to generate parameters β(l) at all desiredcoarser scales. Using these coarser scale parameters, the MAP segmentationproblem at scale l then becomes

x(l) = argminx(l)s

s

l(l)s (x(l)s ) + β(l)2 t

(l)1 + β

(l)2 t

(l)2

.

Interestingly, this is the same basic problem as we had at the finest scale,but only with different values of the MRF parameters β

(l)1 and β

(l)2 and new

negative log likelihood functions, l(l)s (x

(l)s ).

The pseudocode for this multiresolution segmentation algorithm is givenin Figure 15.7. In practice, the values of β

(l)1 and β

(l)2 at different scales can be

adjusted empirically. One simple choice is to just leave them constant, whichis roughly equivalent to starting with less regularization at course scales andthen increasing the regularization with each successive finer scale.

15.2 Joint Segmentation and Reconstruction

Reconstruction and segmentation are typically viewed as distinct operations,with reconstruction focused on forming an image with continuously valuedpixels, and segmentation focused on assigning each pixel to a specific discreteclass. However, model-based imaging provides a powerful framework for theintegration of these two seemingly distinct operations [24, 20].4

Consider a problem in which the observed data, Y , is formed from a lineartransformation of some underlying image, X; but in addition, we know thateach pixel in X takes on one value from a discrete set of M unknown graylevels. We will denote these M unknown gray levels of the image by the

4The approach in this section follows the method described in [24].

Page 347: Model Based Image Processing (Text)

15.2 Joint Segmentation and Reconstruction 337

parameter vector φ = [φ0, · · · , φM−1]t. Then each individual pixel in X musthave the form

Xs = φZs,

where Zs ∈ 0, · · · ,M − 1 is the discrete class of the sth pixel.

So for example, this is a reasonable model to assume in many real-worldtomographic reconstruction problems. In X-ray transmission tomog-raphy, the measurements, Ys, are formed from 2 or 3-D integral projectionsof the image, X, along lines. Typically, these measurements are noisy andsometimes incomplete due to physical limitations or opaque obstructions inthe object. Since these projections are linear integrals, the model for thisproblem is exactly of the form of equation (7.4) from Chapter 6. So, we havethat

Y = AX +W ,

where A is a sparse matrix with entries Ai,j that are proportional the inter-section of the ith projection ray with the jth pixel.

In many tomographic imaging applications, it is reasonable to assume theobject being imaged comprises a set of discrete materials. So for example,the object might be made of air, plastic, aluminum, etc. In this case, weknow that each pixel, Xs, takes on only one of M distinct values dependingin which material the pixels s lies. So if φ = [φ0, · · · , φM−1]t represents the Mpossible X-ray densities corresponding to M materials, then each pixel canbe represented as Xs = φZs

, where Zs is the class of the sth pixel. Takingsome notational liberties, we may write that X = φZ , and the forward modelof the data given the unknowns, X and φ, may be written as

Y = AφZ +W . (15.16)

This new system model of equation (15.16) creates a powerful synergybetween both a continuous and discrete representations of the problem. In-tuitively, it can dramatically reduce the amount of data required to solve theassociated inverse problem by putting a strong constraint on the solution.Rather than requiring a general solution X ∈ R

N , we need only estimate theM continuously valued densities together with the discrete classifications ofeach pixel.

So our objective will be to simultaneously estimate Z and φ. This can bedone in many ways, but here we choose to use the joint-MAP estimator of

Page 348: Model Based Image Processing (Text)

338 Bayesian Segmentation

Section 10. To do this, we first define the MAP cost function given by

f(z, φ) = − log p(y|z, φ)− log p(z) + constant

=1

2||Y − Aφz||2Λ +

s,r∈Cβr−sδ(zr 6= zs) ,

and then the joint-MAP estimate of equation (10.1) is given by

(z, φ) = arg minz∈ΩN, φ∈RM

f(z, φ) ,

where Ω = 0, · · · ,M − 1. In many cases, it is reasonable to enforce theadditional constraint of positivity, so that φ ∈ R

+M . It is relatively straight-forward to do this, but to keep things simple, we will not include a positivityconstraint here.

Now in order to make the problem easier to solve, we will introduce somenew notation. Let Jz be an N ×M matrix with binary entries given by

[Jz]i,j = δ(j − 1− zi) ,

where the pixels are assumed to be indexed in raster order so that i =1, 2, · · · , N . So for example, if M = 3 and z = [0, 2, 1, 1]t, then

Jz =

1 0 00 0 10 1 00 1 0

,

so that every row of Jz has a single entry of 1 in the location correspondingto class zs. With this structure, we can then specify the gray level image X

as

X = Jzφ ,

where the sth row of the matrix Jz selects the entry of the vector φ corre-sponding the the class zs. Using this new notation, we can now express theMAP cost function as

f(z, φ) =1

2||Y − AJzφ||2Λ +

s,r∈Cβr−sδ(zr 6= zs) . (15.17)

Page 349: Model Based Image Processing (Text)

15.2 Joint Segmentation and Reconstruction 339

Now to minimize this MAP cost function, we will use alternating minimiza-tion. More specifically, we need to iteratively solve the following two opti-mization problems.

z ← argminz

f(z, φ) (15.18)

φ ← argminφ

f(z, φ) (15.19)

In practice, each alternating update need not exactly minimize the cost func-tion with respect to its variable. Even an update of the variable that onlyreduces the cost is still very useful and can lead to a local minimum of thecost function.5

Equation (15.18) is simply the MAP estimate for the reconstruction of adiscrete valued image. So our objective will be to perform an update on thediscrete image, z, that reduces the MAP cost function. Since z is discretelyvalued, methods such as gradient descent and conjugate gradient can not beapplied because the gradient of f(z, φ) with respect to z does not exist. Soinstead we will use the method of ICM introduced in Section 15.1.1. However,since ICM is equivalent to ICD, we can also use the methods of Section 5.4to accelerate the computation of the ICM updates.

In order to derive a simple expression for the update of a pixel, first con-sider the pixel at location s with gray level given by X ′s = φzs. If this pixels ischanged to be class k, then its updated gray level will be given by Xs = φk.Recalling that X = Jzφ, then the log likelihood term of the cost function canbe written as a quadratic function of the individual pixel’s gray value,

1

2||Y − AJzφ||2Λ =

1

2||Y − A (X + (Xs −X ′s)εs) ||2Λ

= θ1(Xs −X ′s) +1

2θ2(Xs −X ′s)

2 + const

= θ1(φk − φzs) +1

2θ2(φk − φzs)

2 + const

where εs is a vector that is 1 for the element s and 0 otherwise, and thecoefficients θ1 and θ2 are computed in much the same way as they were forthe ICD update parameters of equations (7.18) and (7.19).

θ1 = −etΛA∗,s5The cost function should be reduced by some percentage of the possible maximum reduction, and this

percentage should be bounded above zero. Otherwise, it is possible to have an asymptotically decreasingreduction that will converge to a value that is bounded away from even a local minimum.

Page 350: Model Based Image Processing (Text)

340 Bayesian Segmentation

Discrete-Continuous ICD Algorithm:

Initialize z and φ

Initialize e = y − Aφz

For K iterations For each pixel s ∈ S

θ1 ← −etΛA∗,s

θ2 ← A∗,stΛA∗,s

zold ← zs

zs ← arg mink∈0,M−1

θ1(φk − φzs) +1

2θ2(φk − φzs)

2 +∑

r∈∂s

βr−s δ(xr 6= k)

e ← e+ A∗,s(zs − zold)

R ← J tzA

tΛAJz

b ← J tzA

tY

φ ← R−1b

e ← y − Aφz

Figure 15.8: A pseudocode specification of the mixed discrete-continuous version ofthe ICD optimization algorithm for computing an approximate joint-MAP estimateof (z, φ). The actual reconstruction is then given by xs = φzs where the values φm

represent the gray levels associated with each of the M classes, and zs represents thediscrete segmentation of the image.

θ2 = A∗,stΛA∗,s .

Using this expression, the ICD update corresponding to equation (7.17) isgiven by

xs ← arg mink∈0,M−1

θ1(φk − φzs) +1

2θ2(φk − φzs)

2 +∑

r∈∂sβr−s δ(zr 6= k)

.

Equation (15.19) updates the parameter vector φ to maximize the MAPcost function. With the quadratic form of equation (15.17), the update of φ

Page 351: Model Based Image Processing (Text)

15.3 ML Parameter Estimation with Stochastic EM 341

is simply the solution to a linear set of equations. More specifically,

φ← argminφ

1

2φtRφ− btφ = R−1b

where

R = J tzA

tΛAJz

b = J tzA

tY .

15.3 ML Parameter Estimation with Stochastic EM

One huge advantage of model-based methods is that model parameters canbe estimated during the inversion process. So for example, in Section 10 wesaw that the model for the observations, Y , and unknown, X, often includesunknown parameters sometimes called hyper-parameters.

More specifically, the joint distribution of (Y,X) can often be written inthe form

log p(y,X|φ, θ) = log p(y|X, φ) + log p(X|θ) , (15.20)

where φ parameterizes the system model, and θ parameterizes the prior dis-tribution. So for example, φ might represent unknown parameters of thenoise amplitude or perhaps the point-spread function of an imaging system;and θ can represent the unknown scale parameter of an MRF that controlsthe level of regularization.

Now, if both Y and X are known, than these parameters can be estimatedusing standard estimators such as the ML estimate. However, this is usuallynot the case. In fact, it is almost always the case that X is not known sincethe objective of Bayesian estimation is to determine X!

The EM algorithm introduced in Chapter 11 is precisely designed to han-dle this missing data problem, so an obvious solution is to simply use it toestimate (φ, θ) from Y . However, there is a catch. In Section 12.3.3, the EMalgorithm was used to estimate the parameters of an HMM; but in this case,we could also use the forward-backward algorithm of Section 12.3.2 to exactlycompute the posterior probabilities of X given Y . However, when X is a 2-DMRF, then generally it is not possible to compute the posterior distribution

Page 352: Model Based Image Processing (Text)

342 Bayesian Segmentation

in closed from; so it is therefore, not possible to compute the E-step of theEM algorithm in closed from either. As a partial solution to this dilemma, inSection 10 we introduce the joint-MAP estimate of equations (10.10) and theadjustment factor approach of equation (10.11) as heuristic techniques thatdo not employ the true ML estimator.

However, if one desires to compute the true ML estimate of parameters(φ, θ) it is possible to do this numerically in a tractable way by using theMonte Carlo sampling techniques of Chapter 14 and Section 15.1.2. In or-der to do this, we generate samples from the posterior distribution using theHastings-Metropolis algorithm, and then we use those samples to approx-imate the expectation required for the E-step in the EM algorithm. Thisapproach to the EM algorithm using Monte Carlo sampling is known asstochastic EM. In order to implement it, we must first generate samplesfrom a Gibbs distribution using an energy function with the form of equa-tion (15.11), so that

u(x) = − log p(y|x)− log p(x) + constant .

Then, L samples are generated from the posterior distribution by samplingfrom the Gibbs distribution

X(l) ∼ 1

zexp −u(x) .

In general, the EM update equations for the estimation of φ and θ aregiven by

E-step: q(φ, θ;φ(k), θ(k)) = E[log p(y,X|φ, θ)|Y = y, φ(k), θ(k)]

M-step: (φ(k+1), θk+1) = argmaxφ,θ

q(φ, θ;φ(k), θ(k))

However, using the structure of equation (15.20), we can decompose the q

function into its two components resulting in the decoupled EM updates givenbelow.

E-step: q1(φ;φ(k), θ(k)) = E[log p(y|X, φ)|Y = y, φ(k), θ(k)]

q2(θ;φ(k), θ(k)) = E[log p(X|θ)|Y = y, φ(k), θ(k)]

Page 353: Model Based Image Processing (Text)

15.3 ML Parameter Estimation with Stochastic EM 343

M-step: φ(k+1) = argmaxφ

q1(φ;φ(k), θ(k))

θk+1 = argmaxθ

q2(θ;φ(k), θ(k))

Next we can use the methods introduced in Section 11.7 to simplify the EMexpressions when the distributions are exponential, which is almost alwaysthe case. More specifically, if we assume that T1(y, x) is a natural sufficientstatistic for φ, and T2(x) is a natural sufficient statistic for θ, then the MLestimate of φ and θ from the complete data, (Y,X), can be written as

φ = f1(T1(Y,X))

θ = f2(T2(X)) ,

for some function f1(·) and f2(·). Then using the methods of Section 11.7.2,we can derive simplified updates for the EM algorithms based on the expec-tation of the natural sufficient statistics.

E-step: T1 = E

[

T1(y,X)|Y = y, φ(k), θ(k)]

T2 = E

[

T2(X)|Y = y, φ(k), θ(k)]

M-step: φ(k+1) = f1(T1)

θk+1 = f2(T2)

Now we simply replace the expectations of the E-step with a average overthe Monte Carlo samples from the posterior distribution.

E-step: T1 =1

L

L−1∑

l=0

T1(y,X(l)) (15.21)

T2 =1

L

L−1∑

l=0

T2(X(l))

M-step: φ(k+1) = f1(T1) (15.22)

θk+1 = f2(T2)

The following examples shows how this approach can be applied to thespecific example of estimating the parameters of both an MRF, X, and thesystem model, Y given X.

Page 354: Model Based Image Processing (Text)

344 Bayesian Segmentation

In the first example, we illustrate how the stochastic EM algorithm can beused to estimate the parameters, θ, of an unobserved MRF, X. However, todo this, we must be able to compute the ML estimate of θ when X is directlyobserved. From Section 13.5, we know from that the ML estimates of MRFparameters are, in general, difficult to compute due to the often intractablenature of the partition function.

So in order to simplify the example, we will consider a case for which theML estimate of the parameter, θ, has closed form. We note that for a discretevalued MRF, the ML parameter estimate, θ, typically never has closed form.However, approaches do exist for numerically approximating the ML estimatefor discrete MRFs, so these methods can also be used.

Example 15.1. Here we provide an example of using stochastic EM to estimatethe scale parameter of a continuous MRF prior model from noisy observationsof a linear transformation of the image. More specifically, we will assumethat that X has the form of a pair-wise Gibbs distribution using a GGMRFpotential function with an unknown scale parameter, σs.

From Section 6.4, we know that the prior distribution has the form

p(x|σx) =1

zexp

− 1

pσpx

s,r∈Pbs,r|xs − xr|p

, (15.23)

and the ML estimate of σx is given by equation (6.23) as

σpx =

1

N

s,r∈Pbs,r|xs − xr|p . (15.24)

So if we assume a model with the form of equation (7.4), then the associatedenergy function for the Gibbs distribution is exactly the MAP cost functionfrom equation (7.7) and is given by

u(x; σx) =1

2||y − Ax||2Λ +

1

pσpx

s,r∈Pbs,r|xs − xr|p . (15.25)

In fact, it can be shown that the statistic

T (x) =∑

s,r∈Pbs,r|xs − xr|p (15.26)

Page 355: Model Based Image Processing (Text)

15.3 ML Parameter Estimation with Stochastic EM 345

is the natural sufficient statistic for the parameter σx of the exponential dis-tribution of (15.23), and that the ML estimate of σx given in equation (15.24)has the form

σx = (T (x))1/p .

So putting this all together with the updates of equations (15.21) and (15.22)results in the stochastic EM update steps,

E-step: X(l) ∼ 1

zexp

−u(x; σ(k)x )

for l = 1 to L− 1

M-step: σ(k+1)x =

1

LN

L−1∑

l=0

s,r∈Pbs,r|X(l)

s −X(l)r |p

1/p

,

where again θ(k) = σ(k)x is the unknown scale parameter for the MRF. In

practice, this stochastic EM update can often be performed with only L = 1samples from the posterior. This is because even just a single image willtypically have enough pixels to get an accurate estimate of σx.

Our next example is for the estimation of the parameter vector φ whenX is an M-level discrete MRF, and the observations, Y , are conditionallyGaussian with unknown means and variances. In this case, the samplesfrom the posterior distribution can serve double duty by both being usedto perform the E-step of stochastic EM algorithm, while also being used tocompute the MPM estimate ofX as described in Section 15.1.2. The resultingalgorithm is known as the EM/MPM algorithm of [17].

Example 15.2. In this example, we consider the case when our objective isto segment an image by estimating the discrete 2-D MRF, X, from obser-vations, Y , and we must simultaneously estimate the mean and variance forthe observations of each class.

Assume that each pixel, Ys, is conditionally Gaussian with distributionN(µxs

, σ2xs), but the particular values of the parameters µm and σ2

m are un-known for the M classes, m ∈ 0, · · · ,M − 1. So then the negative log

Page 356: Model Based Image Processing (Text)

346 Bayesian Segmentation

EM/MPM Algorithm:

/* Compute EM updates */Repeat until converged

E-step: For l = 1 to L− 1

X(l) ∼ 1

zexp

−u(x;φ(k))

M-step:

N (k+1)m =

1

L

s∈S

L−1∑

l=0

δ(X(l) −m)

µ(k+1)m =

1

Nm

s∈S

L−1∑

l=0

Ys δ(X(l) −m)

σ2(k+1)m =

1

Nm

s∈S

(Ys − µm)2δ(X(l) −m)

/* Compute MPM estimate */For each pixel

Compute the conditional histogram

hs(xs) =1

L

L−1∑

l=0

δ(

X(l)s − xs

)

.

Compute approximate MPM estimate

xs ← argmaxxs

hs(xs)

Figure 15.9: A pseudocode specification of the EM/MPM algorithm. The stochasticsampling methods of Chapter 14 are used to generate samples from the posteriordistribution. Then these samples are used both to perform the E-step of the EMalgorithm, and also to compute the MPM estimate of the segmentation X.

likelihood is given by

l(ys|xs, φ) =1

2σ2xs

(ys − µxs)2 +

1

2log(

2πσ2xs

)

,

and the MAP cost function is given by

u(x;φ) =∑

s∈Sl(ys|xs, φ) + β

s,r∈Cδ(xr 6= xs) ,

where φ = µ0, σ20, · · · , µM−1, σ2

M−1 is the unknown parameter that we wouldlike to estimate.

Page 357: Model Based Image Processing (Text)

15.3 ML Parameter Estimation with Stochastic EM 347

Now if both Y and X were available, then the ML estimates of µm andσ2m can be easily estimated as

Nm =∑

s∈Sδ(Xs −m)

µm =1

Nm

s∈SYsδ(Xs −m)

σ2m =

1

Nm

s∈S(Ys − µs)

2δ(Xs −m) .

However, if the X is not known, then we can use the EM algorithm toestimate the parameters µm and σ2

m. To do this, we simply take the posteriorexpectation of the natural sufficient statistics as described in more detail inSection 11.7.2. This results in the following EM-update.

N (k+1)m =

s∈SPXs = m|Y = y, φ(k)

µ(k+1)m =

1

Nm

s∈SYsPXs = m|Y = y, φ(k)

σ2(k+1)m =

1

Nm

s∈S(Ys − µs)

2PXs = m|Y = y, φ(k)

Of course, the problem with this approach is that there is no closed formexpression for the probability PXs = m|Y = y, φ(k) when X has a discretemulti-level MRF distribution. So instead we generate L samples from theposterior distribution X(l) ∼ 1

z exp −u(x;φ), and then we use these samplesto compute the approximate posterior probabilities.

This results in the following stochastic EM update steps,

E-step: X(l) ∼ 1

zexp

−u(x;φ(k))

M-step: N (k+1)m =

1

L

s∈S

L−1∑

l=0

δ(X(l)s −m)

µ(k+1)m =

1

LNm

s∈S

L−1∑

l=0

Ys δ(X(l)s −m)

Page 358: Model Based Image Processing (Text)

348 Bayesian Segmentation

σ2(k+1)m =

1

LNm

s∈S

L−1∑

l=0

(Ys − µm)2δ(X(l)

s −m) ,

where again φ(k) = µ(k)0 , σ

2(k)0 , · · · , µ(k)

M−1, σ2(k)M−1 are the mean and variance

for each classes conditional distribution.

Page 359: Model Based Image Processing (Text)

15.4 Chapter Problems 349

15.4 Chapter Problems

1. Let f : IRN → IR be a continuous convex function which is differentiableevery where and has a unique global minima. Let x ∈ 0, 1N be abinary valued vector with N components. We would like to compute

x = arg minx∈0,1N

f(x) .

a) Is the minimum unique? Prove your answer or give a counter example.

b) Does the Gauss-Seidel/Coordinate search method converge to a globalminimum? Prove your answer or give a counter example.

2. Show that T (x) of equation (15.26) is the natural sufficient statistic forthe parameter σx of the exponential distribution of (15.23).

Page 360: Model Based Image Processing (Text)

350 Bayesian Segmentation

Page 361: Model Based Image Processing (Text)

Chapter 16

Modeling Poisson Data

In the previous chapters, we have modeled the signal as a continuously valuedrandom quantity. However, physics tells us that ultimately physical phenom-ena come in discrete quanta. In electromagnetic imaging systems, such asoptical cameras or X-ray scanners, these discrete quanta correspond to in-dividual photons of light. In other imaging systems, these discrete eventsmay correspond to the count of detected electrons in an electron microscope,or the count of neutrons in a neutron imaging system. In all these cases,the most sensitive imaging systems measure discrete counts of events ratherthan continuous signals. In order to optimally process these discrete mea-surements, we will need to accurately model them; and the model of choiceis typically the Poisson distribution.

In this chapter, we will delve into the details of model-based imaging withPoisson data. The detailed mechanics of modeling Poisson data are quite dif-ferent than in the additive Gaussian noise case. First, the variance of Poissonmeasurements increases with the mean. This means that the noise actuallyincreases with the signal strength, leading so some counter-intuitive results.Also, Poisson measurements have a uniquely distinct interpretation when theevent counts are zero. The observation of “nothing” provides important in-formation in an event counting system, which is both subtly and accuratelyquantified by the Poisson distribution. However, working with Poisson distri-butions can be challenging because the associated log likelihood terms, whileconvex, do not have a quadratic form. In order to address this challenge, wewill introduce quadratic surrogate functions that can be used to successivelyapproximate the true Poisson expressions; thus leading to computationallytractable algorithms with guaranteed convergence.

Page 362: Model Based Image Processing (Text)

352 Modeling Poisson Data

16.1 The Poisson Forward Model

In order to build a foundation for the modeling of event-counting systems,we start by considering the attributes of Poisson random variables. LetY ∈ Z

+ denote a Poisson random variable. Then its probability mass function(PMF) is given by

pλ(y) , PλY = y = λye−λ

y!, (16.1)

where λ ≥ 0 parameterizes the distribution. For notational simplicity, wewrite that Y ∼ Pois(λ). From this form, it is easily shown that the PMFsums to 1 and that Y has a mean and variance of λ,

∞∑

y=0

pλ(y) =∞∑

k=0

λke−λ

k!= 1 (16.2)

E[Y ] =∞∑

k=0

kλke−λ

k!= λ (16.3)

E

[

(Y − λ)2]

=∞∑

k=0

(k − λ)2λke−λ

k!= λ . (16.4)

Intuitively, λ represents the average number of detected events that occurin a measurement period; so in many applications, we can also think of it asan event rate when it is normalized by the detection time. Two importantspecial cases occur when y = 0 and when λ = 0. When λ = 0, the rate is zero,and p0(0) = P0Y = 0 = 1. So in this case, the only possible observation isthat Y = 0, and the probability of any other count is 0.1 When y = 0 thenzero events have been counted. Of course, this can occur whenever λ ≥ 0.In this case, pλ(0) = PλY = 0 = e−λ results in an exponentially decayinglikelihood with increasing λ.

For a Poisson model, the negative log likelihood can be written as

l(λ) = − log p(y|λ)= λ− y log λ+ log (y!) , (16.5)

1The form of the PMF in equation (16.1) works in this case, but requires the interpretations that 00 = 1and 0! = 1.

Page 363: Model Based Image Processing (Text)

16.1 The Poisson Forward Model 353

where we suppress the dependence on the data, y, for notational clarity. Fromthis, we can also derive the ML estimate of the parameter λ to be

λ = argminλ≥0

l(y|λ) = argminλ≥0λ− y log λ+ log (y!) = y . (16.6)

So the ML estimate of the rate is simply the observed number of events, Y .

In the Bayesian framework, we will often assume that the rate of thePoisson random variable is itself random. So in this case, the conditionaldistribution of Y ∈ Z

+ given X ∈ R+ has the form

p(y|x) = xye−x

y!,

and for notational convenience we write that Y |X ∼ Pois(X) to indicatethat the conditional distribution of Y given X is Poisson with rate X. Whencomputing Bayesian estimates, we will often want to use the associated loglikelihood of equation (16.5) as our forward model for a photon-countingsystem. In this case, the negative log likelihood and its derivative are givenby the following equations.

l(x) = x− y log x+ log (y!) (16.7)

l′(x) = 1− y/x (16.8)

Both these functions are plotted in Figure 16.1 for the case of y = 1. Notice,that both functions are unbounded at x = 0, which is very important andwill cause many headaches later. In addition, when y 6= 0 the negative loglikelihood function is strictly convex while its derivative is strictly concave.2

The convexity of the negative log likelihood will be of critical importancein computing MAP estimators. This is because we know from Chapter 7 thestrict convexity of the MAP cost function can be used to ensure that theglobal minimum exists, is unique, and can be efficiently computed. Perhapssurprisingly, concavity of the negative log likelihood’s derivative will alsoserve a crucial role in the design of convergent optimization algorithms forMAP reconstruction. In this case, the concavity can be used to constructsurrogate functions to the log likelihood in a manner similar to that used forthe potential functions in Section 8.3 on page 153.

2When y = 0, the functions are linear, so they are both convex and concave.

Page 364: Model Based Image Processing (Text)

354 Modeling Poisson Data

0 1 2 3 4 50

1

2

3

4

l(x) for Y=1

0 1 2 3 4 5−1

−0.5

0

0.5

l′(x) for Y=1

(a) (b)

Figure 16.1: Plots of (a) l(x) the negative log likelihood of the Poisson distributionwith an observation of Y = 1 and (b) its derivative. Notice that both functions areunbounded at x = 0, and that the negative log likelihood function is convex and itsderivative is concave.

While the negative log likelihood function is convex, its form can be moredifficult to deal with then the quadratic functions of previous chapters. Onesimplification is to approximate l(x) using a Taylor series about some pointof approximation x′.

l(x) = x− y log x+ log (y!) (16.9)

≈ a+ b(x− x′) +c

2(x− x′)2 (16.10)

where the Taylor series coefficients are given by

a = x′ − y log(x′) + log(y!)

b = 1− y/x′

c = y/(x′)2 .

One particular case of importance is when the point of approximation, x′, istaken to be the ML estimate x′ = y. In this case, b = 0 and c = 1/y, so theTaylor series approximation to the negative log likelihood has the form

l(x) ≈ 1

2y(x− y)2 + const , (16.11)

where the term of const = y − y log y + log(y!) can usually be dropped sinceit is not a function of x. The approximation of equation (16.11) is sometimes

Page 365: Model Based Image Processing (Text)

16.1 The Poisson Forward Model 355

referred to as the “Gaussian approximation” to the Poisson distribution. In-tuitively, this comes from the fact that for large counts the random variable Ycan be approximated as Gaussian with mean µ = x and variance σ2 = x ≈ y.However, this is really a misnomer since it is not the probability density thatis being approximated as Gaussian. Instead, it is the log likelihood functionthat is being approximated as being quadratic.

The approximation of equation (16.11) is very useful at high count ratessince it converts the problem of MAP estimation with Poisson noise to thesimpler problem of MAP estimation with Gaussian noise. So for example,if a vector of measurements, Y , are independent Poisson random variables,then following the approach of [58] the expression of equation (16.11) can beused to approximate the MAP cost function as

l(x) =1

2||y − x||2Λ + const (16.12)

where

Λ = diag1/y1, · · · , 1/yN . (16.13)

So this results in what appears to be a Gaussian approximation for the data,Y , except that the data is used to also compute the precision matrix Λ. Infact, Section 10.2 discusses the problem of parameter estimation for a similarmodel that arises out of photon counting data, and presents a method foradaptively estimating an unknown noise gain factor.

However, approximation of equation (16.12) has two disadvantages. First,it runs into problems when the photon counts are zero because of the needto compute the terms 1/yi as the elements of Λ. Second, this quadraticapproximation is only accurate when the event count is large, i.e., Yi >>

1. In many applications, this is an excellent approximation, but in someapplications when the photon counts are very low it may happen that Yi <

1, and the “Gaussian approximation” or equivalently quadratic likelihoodapproximation can be very poor.

An alternative approach to simplification of the Poisson log likelihood is touse a surrogate function approach as described in Chapter 8. In Section 16.2we will discuss the issue of constructing surrogate functions for Poisson dis-tributions in detail. Quadratic surrogates simplify the update computationswhile still guaranteeing convergence to the true MAP estimate.

Page 366: Model Based Image Processing (Text)

356 Modeling Poisson Data

Xj - Emmision Rate

ith Photon Counting Detector

Columnator

Ai,jXj

Detection rate from jth voxel

Figure 16.2: This diagram illustrates a typical scenario for an X-ray imaging systemwith a photon counting detector. X-ray photons are emitted from some material. Aparticular voxel may emit photons at a rate Xj . However, only a fraction of thesephotons, Ai,jXj are detected by the ith photon counting detector because a pin-holecollimator blocks all photons that do not fall along the line of interest.

In real applications, each observed Poisson random variable is often theresult of photons emitted from more that one underlying source location.Figure 16.2 illustrates a typical scenario in which the jth photon countingdetector of an array measures the X-ray emissions along a line through theobject. In concept, this model applies to a wide range of imaging applicationssuch as single photo emission tomography (SPECT) and positronemission tomography (PET). In SPECT imaging, a lead collimator isused to form a pin-hole camera by blocking all the photons except those thatare emitted along a line.

With this setup in mind, let Zi,j denote the number of photons detected bythe ith detector that were emitted by the jth voxel. The term voxel refers to avolume element in 3-D and is analogous to a pixel (i.e., picture element) of animage. In this case, Zi,j|Xj ∼ Pois(Ai,jXj) where Ai,j ≥ 0 is the probabilitythat a photon emitted from voxel j will be detected by detector i, and Xj

is the expected number of emissions from voxel j. Since the photon countsare all conditionally independent given X, we can then write down both thePMF and log likelihood for the entire array of photon counts, Z.

pz|x(z|x) =M∏

i=1

N∏

j=1

(Ai,jxj)zi,je−Ai,jxj

zi,j!(16.14)

Page 367: Model Based Image Processing (Text)

16.1 The Poisson Forward Model 357

log pz|x(z|x) =M∑

i=1

N∑

j=1

−Ai,jxj + zi,j log (Ai,jxj)− log(zi,j!)(16.15)

From this it is also clear that the conditional expectation of Zi,j is given by

E[Zi,j|X] = Ai,jXj (16.16)

However, typically the detector will not be able to distinguish betweenphotons emitted from different voxels along the line. So in this case, themeasured photon count will correspond to the sum of photons detected alongthe line.

Yi =N∑

j=1

Zi,j .

It is easily shown that the sum of independent Poisson random variables isalso a Poisson random variable; so therefore we know that

Yi|X ∼ Pois (Ai,∗X) ,

where Ai,∗ denotes the ith row of the matrix A. Furthermore, since each Yi

is formed by the sum of distinct and independent counts, Zi,j, the individualmeasurements Yi must all be independent. Therefore, we may compactlyexpress the distribution of the measured vector as Y |X ∼ Pois(AX). Fromthis, we can write the negative log likelihood of the measured count vector,Y , given X as

log p(y|x) =M∑

i=1

−Ai,∗x+ yi log (Ai,∗x)− log(yi!) , (16.17)

and the associated negative log likelihood function.

l(x) =M∑

i=1

Ai,∗x− yi log (Ai,∗x) + log(yi!) (16.18)

In practice, one might want to use this forward model to compute the MAPestimate of X. In this case, the MAP estimate would then have the form

x = arg minx∈R+N

l(x) + u(x) , (16.19)

Page 368: Model Based Image Processing (Text)

358 Modeling Poisson Data

where u(x) = − log p(x) is the stabilizing function associated with the priormodel and x ∈ R

+N enforces the positivity constraint, then x ∈ R+N is

both a necessary and sufficient condition to ensure that the Poisson rates,Ax, are also non-negative.3 Moreover, if u(x) is a convex function, thenthe optimization problem of equation (16.19) requires the minimization of astrictly convex function on a convex set; so the results of Appendix A applyand it is generally possible to compute a unique global minimum to the MAPoptimization problem.

16.2 ICD Optimization with Surrogate Functions

An alternative approach to simplification of the Poisson log likelihood is touse a surrogate function approximation. Chapter 8 describes how surrogatefunctions work by approximating a function with an upper bound that istypically (but not always) quadratic. Quadratic surrogates allow one to haveones cake and eat it too by making computations simple and still guaranteeingconvergence to the true rather than approximate minimum.

However, using surrogate functions with Poisson data is tricky becausethe negative log likelihood function plotted in Figure 16.1(a) is unboundedon the interval x ∈ [0,∞). Therefore, no quadratic function can boundl(x) for x ≥ 0. Our solution to this problem will be to allow estimates toget arbitrarily close to zero, but not actually ever reach zero. In particular,Theorem 16.2.1 below provides a key piece of machinery for constructingsurrogate functions to Poisson log likelihoods using the methods similar tothose in [70, 71].

3This also requires that∑

j Ai,j 6= 0 for all i, but in practice this is most always the case.

Page 369: Model Based Image Processing (Text)

16.2 ICD Optimization with Surrogate Functions 359

Theorem 16.2.1. Optimal Surrogates for convex functions with concavederivativesLet f : [xmin,∞)→ R be a convex function with derivative f ′ : [xmin,∞)→R that is concave. Then for all x ∈ [xmin,∞) and x′ ∈ (xmin,∞) define

Q(x; x′) = b(x− x′) +c

2(x− x′)2

where b and c are given by

b = f ′(x′) (16.20)

c = 2f(xmin)− f(x′) + f ′(x′)(x′ − xmin)

(x′ − xmin)2(16.21)

is a surrogate function for minimization of f(x) on x ∈ [xmin,∞). Fur-thermore, Q provides the tightest upper bound among all quadratic surrogatefunctions on [xmin,∞).

Proof. See Appendix C.

In order to better understand the intuition behind Theorem 16.2.1 considerthe surrogate function

q(x; x′) = Q(x; x′) + f(x′) .

Then q(x; x′) possesses the two essential properties of an upper boundingsurrogate function.

f(x′) = q(x′; x′)

f(x) ≤ q(x′; x′)

In Theorem 16.2.1, the selection of b ensures that ∂q(x|x′)∂x

x=x′= f ′(x′), so

that the derivative of the surrogate matches the derivative of the functionat the point of approximation. In addition, it can be easily shown that theselection of the coefficient c as specified in equation (16.21) ensures thatf(xmin) = q(xmin; x

′), so that the surrogate exactly matches the function atthe lower bound of the interval.

In order to get more intuition as to how this works, we can apply thisproperty to the Poisson log likelihood given in equation (16.7). So if we

Page 370: Model Based Image Processing (Text)

360 Modeling Poisson Data

choose x′ as our point of approximation, then our search interval will bex ∈ [xmin,∞) where 0 < xmin < x′. In this case the surrogate function isgiven by

l(x; x′) = b(x− x′) +c

2(x− x′)2 (16.22)

where

b = 1− y/x′ (16.23)

c = 2(b− 1)(x′ − xmin) + y log (x′/xmin)

(x′ − xmin)2. (16.24)

Figure 16.3(a) and (b) illustrates the result for x′ = 2 and two values of xmin.Both sub-figures show a negative log likelihood function, l(x), for y = 1; soin both cases, the function takes on its minimum at x = y = 1. However,in Figure 16.3(a) the minimum allowed value is taken to be xmin = 0.2 andin Figure 16.3(b) it is taken to be xmin = 0.5. Notice that the larger valueof xmin = 0.5 results in a tighter bound; however, this is at the expenseof a smaller interval of [0.5,∞). So in this case, the surrogate function isonly valid for x ≥ 0.5. When the interval is enlarged to [0.2,∞), then thesurrogate function bound becomes looser. Generally speaking, a tighter sur-rogate provides a better approximation, so each update is more aggressive,and convergence is likely to be faster.

So while the surrogate function provides an upper bound, one problem isthat it requires the selection of a value xmin. One solution to this problemis to make the choice of this minimum value adaptive. To do this, we willdefine a user selectable parameter, 0 < γ < 1 and then bound the solutionadaptively by setting xmin = γ x′. So for example if γ = 1/10, then with eachiteration of the surrogate function we can reduce the error by 90%.

The following example below illustrates how this technique for construct-ing surrogate functions to the Poisson log likelihood can be used to performICD optimization for the computation of the MAP estimate.

Example 16.1. Consider the problem when our objective is to compute theMAP estimate of equation (16.19) when Y |X ∼ Pois(X). In this case, the

Page 371: Model Based Image Processing (Text)

16.2 ICD Optimization with Surrogate Functions 361

0 1 2 3 4 50

1

2

3

4

Surrogate of l(x) for Xmin

= 0.2

0 1 2 3 4 50

1

2

3

4

Surrogate of l(x) for Xmin

= 0.5

(a) (b)

Figure 16.3: Plots showing the negative log likelihood, l(x), (blue) and the optimalquadratic surrogate function, l(x; x′), (green) for two different values of xmin. In bothcases, y = 1 and x′ = 2, but in (a) xmin = 0.2 and in (b) xmin = 0.5. Notice thatthe surrogate function upper bounds l(x) for x ∈ [xmin,∞). When xmin = 0.2, theinterval [xmin,∞) is larger, but the bound is looser. Alternatively, when xmin = 0.5,the interval [xmin,∞) is smaller, but the bound is tighter.

negative log likelihood is given by

l(x) =M∑

i=1

xi − yi log (xi) + log(yi!) . (16.25)

In order to keep the approach general, we will assume that the prior term,u(x), can be efficiently minimized with respect to individual pixels. Morespecifically, we will assume that there is a set of functions ui(xi, x∂i) thatonly depend on neighboring pixels so that

argminxi

u(x) = argminxi

ui(xi, x∂i) .

So for example if

u(x) =∑

s,r∈Pρ(xs − xr)

from equation (6.6), then

ui(xi, x∂i) =∑

r∈∂iρ(xi − xr) .

Page 372: Model Based Image Processing (Text)

362 Modeling Poisson Data

ICD for Poisson Measurements Y |X ∼ Pois(X):

Initialize 0 < γ < 1Initialize x > 0For K iterations

For each pixel j ∈ 1, · · · , N xmin ← γxj

b ← 1− yj/xj

c ← 2(b− 1)xj(1− γ)− yj log (γ)

x2j(1− γ)2

xj ← arg minα≥xmin

b(α− xj) +c

2(α− xj)

2 + uj(α, x∂j)

Figure 16.4: Pseudocode for ICD computation of the MAP estimate with a Poissonforward model of the form Y |X ∼ Pois(X) and a general prior model. Each ICDupdate assumes the use of a quadratic surrogate function for the Poisson log likeli-hood. The parameter 0 < γ < 1 determines the minimum allowed value of the pixelupdate.

From this, we can write the ICD update for the ith pixel as

xi ← argminα≥0li(α) + ui(α, x∂i) .

where we define the function

li(α) = α− yi log (α) + log(yi!) .

From this, we can then define a quadratic surrogate function with the form

li(α; x′) = b(α− x′) +

c

2(α− x′)2 (16.26)

where x′ is the initial value of the pixel. So the ICD update then becomes

xi ← argminα≥0li(α; x′) + ui(α, x∂i) .

Now since the function li(α) is unbounded as α → 0, we must restrict thesearch interval to α ≥ xmin > 0. In fact, we can make this minimum adaptiveby selecting xmin = γ x′ for some fixed value of 0 < γ < 1. Typically, one

Page 373: Model Based Image Processing (Text)

16.2 ICD Optimization with Surrogate Functions 363

might select 1/10 ≥ γ ≤ 1/4. Substituting this value of xmin = γ x′ intoequation (16.23) and (16.24) then results in the coefficients b and c given by

b = 1− y/x′ (16.27)

c = 2(b− 1)x′(1− γ)− y log (γ)

(x′)2(1− γ)2. (16.28)

Putting this all together results in the ICD update algorithm given in Fig-ure 16.4.

The surrogate function of Theorem 16.2.1 provides the tightest possiblequadratic surrogate function on the interval [xmin,∞]. However, computationof the coefficient c in equation (16.21) can sometimes be difficult because itrequires the evaluation of both f(x) and its derivative f ′(x). The followingproperty often provides a simpler surrogate function that is not quite so tight,but only requires two evaluations of the derivative, f ′(x). In practice, this isoften simpler.

Theorem 16.2.2. Simplified surrogates for convex functions with concavederivativesLet f(x) be a convex function defined on the interval x ∈ [xmin,∞) with aconcave derivative f ′(x). Then the function

Q(x; x′) = b(x− x′) +c

2(x− x′)2

where b and c are given by

b = f ′(x′) (16.29)

c =f ′(x′)− f ′(xmin)

x′ − xmin(16.30)

is a surrogate function for minimization of f(x) on x ∈ [xmin,∞).

Proof. See Appendix C.

The following example shows how the simplified surrogate function can beused for computing the MAP estimate with Poisson observations.

Page 374: Model Based Image Processing (Text)

364 Modeling Poisson Data

0 1 2 3 4 50

1

2

3

4

Simplified Surrogate of l(x) for Xmin

= 0.2

0 1 2 3 4 50

1

2

3

4

Simplified Surrogate of l(x) for Xmin

= 0.5

(a) (b)

Figure 16.5: Plots showing the negative log likelihood, l(x), (blue) and the simplifiedquadratic surrogate function, l(x; x′), (green) for two different values of xmin. In bothcases, y = 1 and x′ = 2, but in (a) xmin = 0.2 and in (b) xmin = 0.5. Notice that thesurrogate function upper bounds l(x) for x ∈ [xmin,∞). However, these surrogatefunctions are not as tight as the optimal quadratic surrogate functions of Figure 16.3.

Example 16.2. In this example, we will again consider the problem of Ex-ample 16.2, but we will use the simplified quadratic surrogate function ofTheorem 16.2.2.

As in the previous example, each ICD pixel update is given by

xi ← argminα≥0li(α; x′) + ui(α, x∂i) .

where new li(α; x′) is the simplified quadratic surrogate again with the form

li(α; x′) = b(α− x′) +

c

2(α− x′)2

Once again, we will adaptively choose the minimum value so that xmin = γ x′.We next compute the constants b and c using equations (16.29) and (16.30).This results in

b = 1− y/x′ (16.31)

c =y

γx2i. (16.32)

Putting this all together results in the ICD update algorithm given in Fig-ure 16.6.

Page 375: Model Based Image Processing (Text)

16.2 ICD Optimization with Surrogate Functions 365

Simplified ICD for Poisson Measurements Y |X ∼ Pois(X):

Initialize 0 < γ < 1Initialize x > 0For K iterations

For each pixel j ∈ 1, · · · , N xmin ← γxj

b ← 1− yj/xj

c ← yjγx2

j

xi ← arg minα≥xmin

b(α− xj) +c

2(α− xj)

2 + uj(α, x∂j)

Figure 16.6: Pseudocode for Simplfied ICD computation of the MAP estimate witha Poisson forward model of the form Y |X ∼ Pois(X) and a general prior model. Thisalgorithm differs from the one in Figure 16.4 because it uses a simplified surrogatefunction that results in a simpler calculation for the coefficient c.

This same surrogate function approach can also be applied for the directminimization of the MAP cost function when Y |X ∼ Pois(AX). In this case,Y is formed from conditionally independent Poisson random variables with aconditional mean of AX. In this case, the negative log likelihood is given by

l(x) =M∑

i=1

Ai,∗x− yi log (Ai,∗x) + log(yi!) . (16.33)

Since our objective will be to use ICD optimization, we must consider howthe likelihood changes when we update the jth pixel, xj. Referring back toSection 5.4, we can express the update of a single pixel as

x← x′ + αεj , (16.34)

where εj is a vector that is 1 for element j and 0 otherwise, x′ is the initialimage before the pixel is updated, and x is the resulting image after updatingthe jth pixel to take on the value α. Substituting equation (16.34) into (16.33)then results in

l(x′ + αεj)

Page 376: Model Based Image Processing (Text)

366 Modeling Poisson Data

=M∑

i=1

yi + Ai,jα− yi log (yi + Ai,jα) + log(yi!) .

where y = Ax′. Intuitively, y represents the expected photon count for eachmeasurement assuming the initial value of the image. Now dropping anyconstants, we obtain lj(α; y), the negative log likelihood function for the jth

pixel, and its derivative l′j(α; y).

lj(α; y) =M∑

i=1

Ai,jα− yi log (yi + Ai,jα) (16.35)

l′j(α; y) =M∑

i=1

(

1− yiyi + Ai,jα

)

Ai,j (16.36)

From this, we can once again define a quadratic surrogate function with theform

Qj(α; y) = bα +c

2α2 . (16.37)

Now at this point, we can calculate the constants b and c based on eitherthe optimal surrogate function of Theorem 16.1 or the simplified surrogatefunction of Theorem 16.2.2. Both surrogate functions will use the same ex-pression for b, but they will result in different expressions for c. In each case,Qj(α; y) will be a surrogate for the minimization of lj(α; y) on an intervalα ∈ [αmin,∞). Notice that since α represents the change in a pixel value, itcan be negative. However, the sum of α and the original pixel value x′j mustbe bounded above zero; so we have that xj + α ≥ xmin = γx′j . This resultsin the relationship that

αmin = (γ − 1)x′j

We can calculate an expression for the coefficient b from equation (16.20)by simply differentiating equation (16.37) above and evaluating the result atα = 0 to yield

b = l′j(0; y) (16.38)

=M∑

i=1

(

1− yiyi

)

Ai,j , (16.39)

Page 377: Model Based Image Processing (Text)

16.3 Poisson Surrogate Based on EM Algorithm 367

where again y = Ax′. The expression for c is calculated using equation (16.21)using the likelihood function li(α; y) in place of f(x). This results in

c = 2∆l + b x′j(1− γ)

(x′j)2(1− γ)2

, (16.40)

where

∆l , lj(αmin; y)− lj(0; y) ,

where lj(α; y) is computed from equation (16.35)). Notice the expression forlj(α; y) contains logarithms so its evaluation can be more computationallyexpensive.

An alternative approach is to use the simplified surrogate function of The-orem 16.2.2 based on the expression for c in equation (16.30). In this case, cis given by

c =l′j(0; y)− l′j(αmin; y)

x′j(1− γ),

where l′j(α; y) is computed from equation (16.36)). Again, putting this alltogether results in the general ICD update algorithm given in Figure 16.7.

16.3 Poisson Surrogate Based on EM Algorithm

While the Poisson negative log likelihood function is convex, minimizationcan still be quite tricky since this is not a quadratic function of x. Theprevious section presented some techniques for directly constructing surrogatefunctions to the Poisson log likelihood.

However, another approach to forming a surrogate function is to use amethod based on the EM algorithm that was first pioneered by Shepp andVerdi [59]. Shepp and Verdi’s method works by using the full set of un-known counts, Zi,j, as the complete information, and then using the subsetof information, Yi, as the incomplete information.

Referring back to Section 16.1, we can think of each Zi,j as being photonsindependently generated at a conditional rate of Ai,jXj. Then the actual

Page 378: Model Based Image Processing (Text)

368 Modeling Poisson Data

ICD for Poisson Measurements Y |X ∼ Pois(AX):

Initialize 0 < γ < 1Initialize x > 0y ← AxFor K iterations

For each pixel j ∈ 1, · · · , N αmin ← −(1− γ)xj

b ← l′j(0; y) using equation (16.36)

c ←l′j(0; y)− l′j(αmin; y)

xj(1− γ)using equation (16.36)

α ← arg minα≥αmin

bα +c

2α2 + uj(α + xj, x∂j)

y ← y + A∗,jα

xj ← xj + α

Figure 16.7: Pseudocode for ICD computation of the MAP estimate with a Poissonforward model of the form Y |X ∼ Pois(AX) and a general prior model. EachICD update assumes the use of a quadratic surrogate function for the Poisson loglikelihood. The parameter 0 < γ < 1 determines the minimum allowed value of thepixel update.

observations, Yi, are formed by

Yi =N∑

j=1

Zi,j ;

so that it then has a conditional distribution given by Yi|X ∼∑N

i=1Ai,jXj.This also implies that the complete set of photon counts has conditionaldistribution Zi,j|X ∼ Pois(Ai,jXj).

Given this framework, our objective is to derive a surrogate function forthe negative log likelihood function l(x) = − log p(y|x). To do this, we willadapt the Q function of the EM algorithm from Chapter 11 equation (11.11).Recall that the function Q(x; x′) of the EM algorithm is a surrogate functionfor the maximization of the log likelihood log p(y|x). So given this fact, ourapproach will be to calculate an expression for the Q function, and then define

Page 379: Model Based Image Processing (Text)

16.3 Poisson Surrogate Based on EM Algorithm 369

a general surrogate function for the negative log likelihood as

l(x; x′) = −Q(x; x′) + const , (16.41)

where const is anything that is not a function of x. We can do this byusing the following formula for the Q function adapted from Chapter 11equation (11.11).

Q(x; x′) = E[log p(Z|x)|Y = y, x′] (16.42)

Using the log likelihood expression of equation (16.15), we can substitute intothe expression of equation (16.42).

Q(x; x′) = E[log p(Z|x)|Y = y, x′]

= E

[

M∑

i=1

N∑

j=1

−Ai,jxj + Zi,j log(Ai,jxj)− log(zi,j!)∣

Y = y, x′]

=M∑

i=1

N∑

j=1

−Ai,jxj + Zi,j log(Ai,jxj)

+ const

where

Zi,j = E[Zi,j|Y = y, x′]

Now in order to simplify the expression for Zi,j, we will first need to definesome additional terms. Define

Z(c)i,j =

k 6=j

Zi,k = Yi − Zi,j , (16.43)

so that Yi = Zi,j + Z(c)i,j where Zi,j and Z

(c)i,j are independent with conditional

means given by

λ1 , E[Zi,j|X] = Ai,jXj (16.44)

λ2 , E

[

Z(c)i,j

∣X]

=∑

k 6=j

Ai,kXk . (16.45)

So using the facts that Yi = Zi,j + Z(c)i,j and that Zi,j is independent of Yk for

k 6= i, then we have that

Zi,j = E[Zi,j|Y = y, x′]

= E[Zi,j|Yi = yi, x′]

= E

[

Zi,j

∣Zi,j + Z

(c)i,j = yi, x

′]

Page 380: Model Based Image Processing (Text)

370 Modeling Poisson Data

Now in order to evaluate this last expression for Zi,j, we first derive an explicit

expression for the joint conditional PMF of Zi,j and Z(c)i,j given X.

pz,z(c)|x(k, l|x′) , P Zi,j = k, Z(c)i,j = l |X = x′

=λk1e−λ1

k!

λl2e−λ2

l!From this we know that

pz,z(c)|y,x(k, l|yi, x′) , P

Zi,j = k, Z(c)i,j = l

∣Zi,j + Z(c)i,j = yi, X = x′

=1

zpz,z(c)|x(k, l|x′) δ(k + l = yi)

where z is the normalizing constant required so that pz,z(c)|y(k, l|yi) sums to1. So from this we can see that

pz|y,x(k|yi, x′) , P

Zi,j = k|Zi,j + Z(c)i,j = yi, X = x′

= P

Zi,j = k, Z(c)i,j = yi − k

∣Zi,j + Z(c)i,j = yi, X = x′

=1

zpz,z(c)|x(k, yi − k|x′) .

From this point, it is simply a matter of algebra to show the result that

pz|y,x(k|yi, x′) =1

zpz,z(c)(k, yi − k|x′)

=

(

yik

)(

λ1

λ1 + λ2

)k (λ2

λ1 + λ2

)yi−k. (16.46)

The form of equation (16.46) is the binomial distribution with parameters yiand

p =λ1

λ1 + λ2.

So we denote this by Zi,j|(Y,X) ∼ B(yi, p). From this we can calculate theconditional expectation required for Zi,j as

Zi,j = yiλ1

λ1 + λ2

= yiAi,jx

′j

∑Nj=1Ai,jx′j

Page 381: Model Based Image Processing (Text)

16.3 Poisson Surrogate Based on EM Algorithm 371

Now going back to equation (16.41), we have that

l(x; x′) = −Q(x; x′) + const

=M∑

i=1

N∑

j=1

Ai,jxj − Zi,j log(Ai,jxj)

+ const

=N∑

j=1

M∑

i=1

Ai,jxj − Zi,j log(xj)

+ const

=N∑

j=1

(

M∑

i=1

Ai,j

)

xj −(

M∑

i=1

Zi,j

)

log(xj)

+ const

=N∑

j=1

αjxj − βj log(xj)

where

αj =M∑

i=1

Ai,j

βj = x′j

M∑

i=1

yiAi,j∑N

k=1Ai,kx′k

So in summary, a surrogate function for the negative log likelihood of thePoisson distribution given by

l(x) =M∑

i=1

Ai,∗x− yi log (Ai,∗x) + log(yi!) , (16.47)

is given by

l(x; x′) =N∑

j=1

αjxj − βj log(xj)

where

αj =M∑

i=1

Ai,j

βj = x′j

M∑

i=1

yiAi,j∑N

k=1Ai,kx′k

Page 382: Model Based Image Processing (Text)

372 Modeling Poisson Data

EM Optimization for Poisson Measurements Y |X ∼ Pois(AX):

Initialize 0 < γ < 1Initialize x > 0For K iterations

For each pixel j ∈ 1, · · · , N

αj ←M∑

i=1

Ai,j

βj ← xj

M∑

i=1

yiAi,j∑N

k=1 Ai,kxkFor each pixel j ∈ 1, · · · , N

xmin ← γxj

b ← αj − βj/xj

c ← βj

γx2j

xi ← arg minα≥xmin

b(α− xj) +c

2(α− xj)

2 + uj(α, x∂j)

Figure 16.8: Pseudocode for EM computation of the MAP estimate with a Poissonforward model of the form Y |X ∼ Pois(AX) and a general prior model. This algo-rithm uses the EM surrogate function together with the ICD optimization algorithmof Figure 16.6.

The crucial value of this result is that the surrogate function, l(x; x′) is asum of decoupled terms index by j the pixel index. This means that theEM surrogate function appears as if the Poisson measurements are madeindependently at each pixel!

Putting this all together, Figure 16.8 shows the final algorithm result-ing from the integration of the EM algorithm surrogate function with ICDoptimization for the M-step using the algoirthm of Figure 16.6.

Page 383: Model Based Image Processing (Text)

16.4 Chapter Problems 373

16.4 Chapter Problems

1. Calculate the sum, mean, and variance of the PMF for the Poissondistribution given in equations (16.2), (16.3), and (16.4).

2. Calculate the ML estimate of X given Y of equation (16.6).

3. Let Y =∑N

i=1 Zj be the sum of N independent Poisson random variableseach with Zj ∼ Pois(λj). Show that Y is then Poisson with meanλ =

∑Ni=1 λj.

4. Derive the ML estimate of λ given Y of equation (16.6).

5. Show that the negative log likelihood function of equation (16.17) isconvex.

6. Let Y |X ∼ Pois(X) where X and Y are both scalars, so that

l(y|x) = − log p(y|x) = x− y log x+ log(y!) .

a) Show that for all y ∈ Z+ that l(y|x) is a convex function of x.

b) Show that for all y ∈ Z+ that l′(y|x) is a concave function of x where

l′(y|x) , ∂l(y|x)∂x .

7. Consider the surrogate function Q(x; x′) defined in Theorem 16.2.1. Fur-thermore, define

q(x; x′) = Q(x; x′) + f(x′) .

Show that the following are true.

a) Show that q(x′|x′) = f(x′).

b) Show that ∂q(x|x′)∂x

x=x′= b = f ′(x′).

c) Show that q(xmin|x′) = f(xmin).

8. Prove that Zi,j and Z(c)i,j defined in equation (16.43) are independent with

conditional means given by equations (16.44) and (16.45).

Page 384: Model Based Image Processing (Text)

374 Modeling Poisson Data

Page 385: Model Based Image Processing (Text)

Chapter 17

Advanced Models

17.1 Tomographic Forward Models

17.2 Advanced Prior Models

17.3 Sparse Linear Basis Models

17.4 Dictionary Prior Models

Page 386: Model Based Image Processing (Text)

376 Advanced Models

17.5 Chapter Problems

1. Problems go here

Page 387: Model Based Image Processing (Text)

Appendix A

A Review of Convexity inOptimization

In order to better understand the use of convex potential functions in priormodeling, we first need to review some basic definitions and properties ofconvex functions and sets. We start with the definition of a convex set inR

N .

Definition: A set A ⊂ RN is said to be a convex set if for all x, y ∈ A

and for all 0 < λ < 1,

λx+ (1− λ)y ∈ A .

So a convex set has the property that any line connecting two points in Ais contained within the set A. Convex sets occur commonly, and includesets such as R

N and R+N = x ∈ RN : ∀i xi ≥ 0. This latter set is

very important because it is often used as a constraint on the solution ofMAP estimates when x is an image. Below are some important and usefulproperties of convex sets.

Property A.1. Basic properties of convex sets - Let A and B be convex subsetsof RN ; let C be a convex subset of RM ; and let A be a M ×N matrix. Thenthe following properties hold.

a) The set A ∩ B is a convex set.

b) The set x ∈ RN : Ax ∈ C is convex.

c) The set RN is a convex set.

Page 388: Model Based Image Processing (Text)

378 A Review of Convexity in Optimization

−2 −1 0 1 20

1

2

3

4

5y = (x−1)2*(x+1)2 + x+1.1

−2 −1 0 1 20

1

2

3

4

5y = exp( − x )

−2 −1 0 1 20

1

2

3

4

5y = x2

(a) (b) (c)

Figure A.1: Figure a) illustrates an example of a non-convex function, f(x) = (x −1)2(x+1)2+x+1.1, which contains a local minimum that is not global. Alternatively,Figure b) shows an example of a convex function, f(x) = e−x, which has no minima,either local or global. Finally, Figure c) shows the function f(x) = x2, which isstrictly convex with a local minimum, which must also be the global minimum.

d) The set R+N is a convex set.

One very important property of convex sets is stated in the followingtheorem.

Theorem A.0.1. Hilbert Projection TheoremLet A ⊂ R

N be a convex set. Then for all x ∈ RN there exists a unique point

y ∈ A for which ||x− y|| is minimized over all points in A.Using this result, we define the following notation for the projection of avector x onto a non-empty convex set A

x = clipx,A = argminy∈A||x− y|| .

By Theorem A.0.1, we then know that this projection both exists and isunique. This notation will be useful when dealing with convex constraintssuch as positivity. For example, we can enforce positivity using the followingnotation

x = clip

x,R+N

where x is then constrained to be in the non-negative quadrant of RN .

Now that we have defined convex sets, we can use this definition to defineconvex functions.

Definition: Let A be a convex subset of RN . Then we say that a functionf : A → R is convex if for all x, y ∈ A such that x 6= y, and for all0 < λ < 1,

f(λx+ (1− λ)y) ≤ λf(x) + (1− λ)f(y) .

Page 389: Model Based Image Processing (Text)

379

Furthermore, we say that f is strictly convex if the inequality is strict.

Concave functions have a closely related definition.

Definition: Let A be a convex subset of RN . Then we say that a functionf :A → R is (strictly) concave on A if the function −f is (strictly)convex on A.

Convexity is a very valuable property for two reasons. First, it is ofteneasy to show that functions are concave/convex. This is primarily because thesum of convex functions is convex. Second, convex functions have importantadvantages in optimization problems. In particular, it is much easier toguarantee both existence of global minimum and convergence of iterativeoptimization algorithms when the function being minimized is convex. Thefollowing lists out some basic properties of convex functions that will bevery useful. The corresponding results are, of course, also true for concavefunctions by applying these results to the function −f .Property A.2. Basic properties of convex functions - Let A be a convex subsetof RN ; let f :A → R and g :A → R be convex functions; let A be an N ×Mmatrix; and let B be an N ×N symmetric and positive semi-definite matrix.Then the following are true.

a) f(x) is a continuous function on int(A).

b) h(x) = f(Ax) for x ∈ x ∈ RM : Ax ∈ A is a convex function.

c) h(x) = f(x) + g(x) for x ∈ A is a convex function.

d) h(x) = ||x||2B = xtBx for x ∈ A is a convex function.

All these properties are of great value of great value, but property a)above deserves some additional explanation in order to fully understand itsimplications. First, we know that if f is a convex function on A = R

N , thenf must be continuous since int(RN) = R

N . While this is a common case forus, it is important to remember that convex functions need not always becontinuous. To see this, consider the counter example given by the functionf : [0, 1]→ R defined below.

f(x) =

1 if x = 0x2 if x ∈ (0, 1]

Page 390: Model Based Image Processing (Text)

380 A Review of Convexity in Optimization

Notice that f is a convex function defined on the convex set [0, 1] ⊂ R; how-ever, f is not continuous at x = 0 since limx→0 f(x) = 0 6= 1. Furthermore, fdoes not take on a local or global minimum because it never actually achievesits infimum. Moreover, this convex function also has the property that forα = 1/2 its sublevel set is not closed.

A1/2 = x ∈ [0, 1] : f(x) ≤ 1/2 =(

0,√

1/2]

This is an important counter example that we should keep in mind. Later wewill introduce the concept of closed convex functions to guard against thissort of situation.

Of course, strict convexity is stronger than convexity, and in some cases,it is very useful. However, the conditions required for strict convexity are abit different and are given below.

Property A.3. Basic properties of strictly convex functions - LetA be a convexsubset of RN ; let f :A → R be a strictly convex function; let g :A → R bea convex function; let A be an N ×M matrix of rank M ; and let B be anN ×N symmetric and positive-definite matrix. Then the following are true.

a) h(x) = f(Ax) for x ∈ x ∈ RM : Ax ∈ A is a strictly convex function.

b) h(x) = f(x) + g(x) for x ∈ A is a strictly convex function.

c) h(x) = ||x||2B = xtBx for x ∈ A is a strictly convex function.

In some cases, it is useful to show that a function is convex by showing itis the point-wise maximum of a set of functions.

Property A.4. Point-wise maximum over sets of convex functions - Let f1(x)and f2(x) be two convex functions, and let g(x, y) be a convex function of xfor each value of y ∈ B where B is not necessarily a convex set. Then thefollowing are true.

a) h(x) = maxf1(x), f2(x) is a convex function.

b) h(x) = supy∈Bg(x, y) is a convex function.

When optimizing functions in high dimensional spaces, it is easy to be-come trapped in local minima. For example, Figure A.1a illustrates a case in

Page 391: Model Based Image Processing (Text)

381

which a function has a local minimum that is not the global minimum. Lo-cal minimum can make optimization very difficult by trapping optimizationalgorithms in poor solutions.

Convex functions and sets are extremely useful concepts in optimizationbecause they can be used to ensure that any local minimum must be global,thereby eliminating this potentially problematic case. To see this, considerthe strictly-convex function shown in Figure A.1b.

In order to make this more precise, we first must give precise definitionsto the concept of global and local minimum of a function. We can do this byusing the concept of an “epsilon ball” about a point x∗.

B(x∗, ǫ) ,

x ∈ RN : ||x− x∗|| < ǫ

So, x∗ is a local minimum of a function f(x) if there exists a sufficiently smallvalue of ǫ so that f(x) ≥ f(x∗) for all the points in the set x ∈ B(x∗, ǫ) ∩A.

Definition: Consider a function f : A → R where A ⊂ R. Then wesay that the function f has a local minimum at x∗ ∈ A if ∃ǫ >

0, such that ∀x ∈ B(x∗, ǫ) ∩ A it is the case that f(x) ≥ f(x∗).

Alternatively, x∗ is a global minimum if it achieves the minimum value ofthe function over the entire domain. So we have the following definition.

Definition: Consider a function f :A → R where A ⊂ RN . Then we say

that the function f has a global minimum at x∗ ∈ A if ∀x ∈ A it isthe case that f(x) ≥ f(x∗).

Using these definitions, we can now state some very powerful theorems aboutthe nature of local and global minimum for convex functions.

Theorem A.0.2. Equivalence of Local and Global Minimum for a ConvexFunctionLet f :A → R be a convex function on a convex set A ⊂ R

N . Then f has alocal minimum at x∗ ∈ A if and only if f has a global minimum at x∗ ∈ A.

This is a powerful theorem because it states that for convex functions, weneed only find local minimum of the function in order to be assured thatthe minima are actually global. In fact, many of the iterative optimizationalgorithms that we have seen operate locally on the function being minimized,

Page 392: Model Based Image Processing (Text)

382 A Review of Convexity in Optimization

so without this theorem, these methods have little chance of obtaining aglobal minimum for very complex functions.

However, while Theorem A.0.2 states that local and global minimum areequivalent, it does not assure that they exist or that they are unique if theydo exist. The following theorem handles the issue of uniqueness when thefunction being minimized is strictly convex.

Theorem A.0.3. Uniqueness of Global Minimum for a Strictly Convex Func-tionLet f :A → R be a strictly convex function on a convex set A ⊂ R

N . Thenif f has a global minimum at x∗ ∈ A then that global minimum must uniqueso that for all x ∈ A such that x 6= x∗, we have that f(x) > f(x∗).

Existence of a global minimum is a more difficult matter. In fact, it is easyto come up with examples of strictly convex functions which have no globalminimum. For example, the function f(x) = e−x shown in Figure A.1(b) issuch an example. In this case, there is no global minimum because the func-tion decreases monotonically toward infinity, never achieving its minimumvalue.

In order to assure the existence of a global minimum, we will need someadditional concepts defined below.

Definition: Let A ⊂ RN , then we say that A is:

– Closed if every convergent sequence in A has its limit in A.– Bounded if ∃M such that ∀x ∈ A , ||x|| < M .

– Compact if A is both closed and bounded.

With these definitions, we can invoke a powerful theorem from analysis whichassures us that any continuous function takes on its minimum and maximumon a compact set [62].

Theorem A.0.4. Weierstrass Extreme Value TheoremLet f :A → R be a continuous function on a compact set A ⊂ R

N . Thenf takes on its global minimum in A, i.e., there exists an x∗ ∈ A such that∀x ∈ A , f(x∗) ≤ f(x).

Putting together the Extreme Value Theorem with the results of Theo-rems A.0.2 and A.0.3 yields the following important result.

Page 393: Model Based Image Processing (Text)

383

Theorem A.0.5. Global Minimum of Convex FunctionsLet f :A → R be a strictly convex continuous function on a compact andconvex set A ⊂ R

N . Then f takes on a unique global minimum at some pointx∗ ∈ A.

Notice that we must explicitly assume continuity of f in Theorem A.0.5because convex functions need not be continuous on the boundary of A.

In many cases, we will be faced with the case where A is closed but notbounded, and therefore not compact. For example, if A = R

N then A is bothopen and closed, but it is neither bounded nor compact. Nonetheless, evenin this case, it can often be shown from the structure of the problem that aglobal minimum exists.

In order to better handle these cases, we define two properties of functionsthat will serve as handy tools. First, we define the sublevel set of a function.

Definition: The α-sublevel set of a function is the set defined by

Aα =

x ∈ RN : f(x) ≤ α

.

Next we define the concept of a compact sublevel set.

Definition: We say that a function f(x) has a compact sublevel setif there exists an α ∈ R such that the sublevel set Aα is compact andnon-empty.

Using this definition, it is easily shown that any strictly convex functionwith a compact sublevel set has a unique global minimum. Armed with thesenew definitions, we may state the following two corollaries of Theorems A.0.4and A.0.5.

Corollary 1. Minimum of Functions with Compact Sublevel SetsLet f : A → R be a continuous function on A ⊂ R

N with a compact sublevelset. Then f takes on a global minimum for some x∗ ∈ A, so that ∀x ∈A , f(x∗) ≤ f(x).

Corollary 2. Global Minimum of Functions with Compact Sublevel SetsLet f :A → R be a strictly convex continuous function on a convex set A ⊂R

N with a compact sublevel set. Then f takes on a unique global minimumfor some x∗ ∈ A, so that ∀x ∈ A , f(x∗) < f(x).

Page 394: Model Based Image Processing (Text)

384 A Review of Convexity in Optimization

These two corollaries remove the need for the domain of a convex functionto be compact in order to ensure that the global minimum exists and isunique. So for example, functions such as f(x) = 1

2xtHx + btx where H

is a positive definite matrix are strictly convex but do not have a compactdomain. Yet, this function is has a compact sublevel set, so it does take ona unique global minimum. (See Problem 2 of Chapter 7)

Finally, we introduce two standard definitions that are commonly used inconjunction with convex functions that take values on the extended real linethat includes∞. We will mostly restrict ourselves to functions that only takevalues in R; so we will mostly avoid using these definitions, but we presentthem here both for completeness and for the special situations when they areuseful.

First we give the definition for an extended convex function whichtakes values on R ∪ ∞.

Definition: We say that the extended function f : RN → R ∪ ∞ isconvex if for all x, y ∈ A and for all 0 < λ < 1,

f(λx+ (1− λ)y) ≤ λf(x) + (1− λ)f(y) ,

where for any a ∈ R∪∞, we define that∞+a =∞ and that∞ ≤∞.

Now it is interesting to note that if f : A → R is a convex function onthe convex set A, then we always have the option of defining a new extendedconvex function given by

f(x) =

f(x) if x ∈ A∞ otherwise

, (A.1)

where it is easily verified that f is convex. (See problem 1) The point here isthat using extended convex functions can sometimes simplify our lives sincethe domain of the function can always be R

N .

However, the downside of extended convex functions is that they can leadto some unintended technical difficulties. A proper convex function is closed ifand only if it is lower semi-continuous So in order to guard against these prob-lems, mathematicians typically also assume that extended convex functionsare also proper and closed. The following two definitions give meaning tothese two terms.

Page 395: Model Based Image Processing (Text)

385

Definition: We say the function f :RN → R ∪ ∞ is proper if thereexists an x ∈ R

N so that f(x) <∞.

So if a function is proper, then we know that it can be not infinite everywhere,which is typically a very reasonable assumption.

Definition: We say the function f :RN → R ∪ ∞ is closed if for allα ∈ R, the sublevel set Aα = x ∈ R

N : f(x) ≤ α is a closed set.

So if a function is proper, then we know that it can be not infinite everywhere,which is typically a very reasonable assumption.

Closure eliminates the possibility that very strange things can happenwhen minimizing a convex function. In particular, while it does not guaran-tee that a minimum exists, it does removed certain pathological cases. Forexample, consider the function

f(x) =

1tx if ||x|| < 1∞ if ||x|| ≥ 1

,

where 1 is a column vector of 1′s. Then in this case f is not closed sincex ∈ R

N : f(x) < ∞ is an open set. However, even though the functionis convex and tends to infinity as ||x|| → ∞, it does not take on a global orlocal minimum. This is because the minimum “should” occur at x = −1,but it doesn’t because f(−1) = ∞. Intuitively, the problem is that f is notcontinuous at x = −1.

We conclude with a result that provides some additional intuition aboutthe nature of proper closed convex functions [4].

Corollary 3. Continuity of Proper Close Convex FunctionsLet f :RN → R ∪ ∞ be a proper convex function. Then f is closed if andonly if it is lower semi-continuous.

So for a proper convex function, closure is equivalent to lower semi-continuity,which is very valuable when minimizing functions.

Page 396: Model Based Image Processing (Text)

386 A Review of Convexity in Optimization

A.1 Appendix Problems

1. Prove statements of Property A.1.

2. Give a counter-example to the following statement. “If A and B areconvex sets, then A ∪ B is a convex set.”

3. Prove the statements a), b), and c) of Property A.3.

4. Prove the statements d) of Property A.3; that is, prove if f :A → R isa convex function on the convex set A ⊂ R

N , then it is a continuousfunction for all x ∈ A.

5. Prove the statements of Property A.3.

6. Prove the Property A.4a.

7. Prove Theorem A.0.2.

8. Prove Theorem A.0.3.

9. Prove Theorem A.0.5.

Page 397: Model Based Image Processing (Text)

Appendix B

The Boltzmann and GibbsDistributions

In this appendix, we derive the general form of the discrete distribution knownas the Boltzmann or Gibbs distribution, and also derive some of its importantproperties.

Let X be a discrete valued random variable with PMF given by px =PX = x. In practice, X can be an array of discrete random variables, butthe key issue is that X takes on values in a discrete set. With each value orstate, x, we will associate an energy denoted by u(x). So then the expectedenergy is given by

E = E[u(X)] =∑

x

u(x) px ,

and the entropy of the random variable X is then defined as

H = E[− log pX ] =∑

x

−px log px .

The first law of thermodynamics states that energy is conserved for aclosed system. So the expected energy, E , must be constant. In addition,the second law of thermodynamics states that the entropy of a closed systemcan only increase with time. Therefore, a closed system in thermodynamicequilibrium is one that has achieved its maximum entropy; so that no furtherincreases in entropy can occur and the system is in a stable equilibrium.

Therefore, the Boltzmann distribution can be derived by maximizing theentropy, H, subject to the constraint that the energy is constant, i.e., E = Eo.Based on this logic, we can derive the Boltzmann distribution by computing

Page 398: Model Based Image Processing (Text)

388 The Boltzmann and Gibbs Distributions

the values of the discrete probabilities, px, that maximize H subject to thetwo constraints that E is constant and

x px = 1.

Using the method of Lagrange multipliers, we can change the constrainedoptimization problem into an unconstrained optimization problem. Then thesolution to the optimization problem can be found by solving the equation

∂px

[

H− β (E − Eo) + λ

(

x

px − 1

)]

= 0 (B.1)

where −β and λ are the Lagrange multiplier constants for the two constraints.In order to evaluation this expression, we first compute derivatives of theenergy and entropy expressions.

∂pxE =

∂px

k

pk u(k) = u(x)

∂pxH =

∂px

k

−pk log pk = −1− log px

Notice that the derivative is only non-zero for the term in which k = x. Usingthese expressions, then equation (B.1) is given by

−1− log px − βu(x) + λ = 0 . (B.2)

Then solving for the value px and applying the constraint that∑

x px = 1results in an explicit form for the density given by

px =1

zβexp −βu(x) , (B.3)

where zβ is the partition function for the distribution given by

zβ =∑

x

exp −βu(x) .

In statistical thermodynamics, the Lagrange multiplier is defined as β = 1kbT ,

where kb is Boltzmann’s constant and T is the temperature in degrees Kelvin.Using this convention, we may rewrite the expression of (B.3) in the standardform

px =1

zβexp −βu(x) , (B.4)

Page 399: Model Based Image Processing (Text)

B.1 Derivation of Thermodynamic Relations 389

where β = 1kbT .

With this expression, we can now view the probability density as a functionof β, a parameter inversely proportional to temperature. So notationally, wemay express this as

pβ(x) , px ,

where the notation pβ(x) emphasizes the dependence on the inverse temper-ature β.

Consequently, the energy and entropy of the system can also be viewed asfunctions of β, resulting in the notation Eβ andHβ. With this in mind, we canderive the following three important properties of systems in thermodynamicequilibrium derived below in Section B.1.

Hβ = βEβ + log zβ (B.5)

d log zβdβ

= −Eβ (B.6)

dHβ

dβ= β

dEβdβ

. (B.7)

So using these results, we can see that the physical temperature is propor-tional to the ratio of the change in energy per unit change in entropy.

T =1

kb

dEdH

Generally, the entropy of a system tends to increase as the energy increases,so generally the physical temperature tends to be positive. But that said, itis physically possible to have negative temperatures when the number of highenergy states in a system is limited. In this case, increasing the energy in asystem can actually reduce the number of possible available states, and there-fore reduce the entropy of the system. When this happens, the temperaturecan become negative.

B.1 Derivation of Thermodynamic Relations

The following derives the relationship of equation (B.5).

Hβ =∑

x

−px log px

Page 400: Model Based Image Processing (Text)

390 The Boltzmann and Gibbs Distributions

=∑

x

px βu(x) + log zβ

= βEβ + log zβ .

The following derives the relationship of equation (B.6).

d log zβdβ

=1

dzβdβ

=1

d

x

exp −βu(x)

= −∑

x

u(x)1

zβexp −βu(x)

= −E

The differentiating equation (B.5) results in the relationship of equa-tion (B.7).

dHβ

dβ= Eβ + β

dEβdβ

+d log zβdβ

= Eβ + βdEβdβ− Eβ

= βdEβdβ

Page 401: Model Based Image Processing (Text)

Appendix C

Proofs of Poisson Surrogates

The following is a proof of Theorem 16.2.1 from Chapter 16.

Proof. In order to simplify the notation of the proof, we may with out lossof generality assume that x′ = 0 and f(x′) = 0. In this case, it must thenbe that xmin < 0 and b = 0. Also, since f(x) is convex and f ′(x) is concaveboth must also be continuous functions of [xmin,∞).

Now in this case, Q(0; 0) = f(0) = 0, so in order to show that Q isa surrogate for the minimization of f(x), we need only show that for allx ∈ [xmin,∞) that Q(x; 0) ≥ f(x). To do this, we start by defining theconvex function g(t) = ct− f ′(t). Then we can show that

Q(x; x′)− f(x) =c

2x2 −

∫ x

0

f ′(t)dt

=

∫ x

0

(ct− f ′(t)) dt

=

∫ x

0

g(t)dt .

By the specific choice of c from equation (16.21), it is easily shown that

f(xmin) = Q(xmin, x′) ;

so we know that∫ xmin

0

g(t)dt = Q(xmin, x′)− f(xmin) = 0 .

Page 402: Model Based Image Processing (Text)

392 Proofs of Poisson Surrogates

Furthermore define the two functions

G1(x) =

∫ x

0

g(t)dt

G2(x) =

∫ xmin

x

g(t)dt .

Then we know that for x ∈ [xmin, 0]

G1(x) +G2(x) =

∫ 0

xmin

g(t)dt = 0 .

Now if we can show that G1(x) ≥ 0 for all x ∈ [xmin,∞), then we knowthat

Q(x; x′)− f(x) = G1(x) ≥ 0 , (C.1)

and we will have proved the result that Q is a surrogate for the minimizationof f(x). Furthermore, since Q(xmin; x

′)−f(xmin) = 0, then any smaller valueof the coefficient c′ < c will violate the surrogate function relationship. Sotherefore, if Q is a surrogate function for the minimization of f(x) then itmust be the tightest quadratic surrogate.

Next, we will show that g0 , g(xmin) ≥ 0. Since g(x) is a convex functionwith g(xmin) = g0 and g(0) = 0, we know that g(t) ≤ g0

txmin

for all t ∈[xmin, 0]. Therefore we have that

0 =

∫ xmin

0

g(t)dt =

∫ 0

xmin

g(t)dt ≤∫ 0

xmin

g0t

xmindt =

g02

.

So therefore, we know that g0 ≥ 0. Now in order to prove the theorem, wewill consider two cases. Case 1 when g0 = 0 and case 2 when g0 > 0.

In case 1 when g0 = 0, then since g(t) is convex with g(0) = 0, then itmust be that g(t) ≤ 0 for t ∈ [xmin, 0). But since g(t) is continuous with∫ 0

xming(t)dt = 0, this implies that g(t) = 0 for t ∈ [xmin, 0), which implies

that for all x ∈ [xmin, 0]

G1(x) =

∫ x

0

g(t)dt =

∫ x

0

0 dt = 0 .

Also, since g(t) is convex and g(xmin) = g(0) = 0, it must be that g(x) ≥ 0for all x ∈ [0,∞), which implies that for all x ∈ [0,∞]

G1(x) =

∫ x

0

g(t)dt ≥ 0 .

Page 403: Model Based Image Processing (Text)

393

So for case 1 we have the result that G1(x) ≥ 0 for all x ∈ [xmin,∞).

In case 2, we assume g0 > 0. Since the function g(t) is continuous with∫ 0

xming(t)dt = 0, there must exist a point x1 ∈ (xmin, 0) such that g(x1) < 0.

Therefore, by the intermediate value theorem, there must exist a point x0 ∈(xmin, x1) such that g(x0) = 0.

Since g(t) is convex, then the following results must hold.

R1 g(x) ≥ 0 for all x ∈ [xmin, x0]

R2 g(x) ≤ 0 for all x ∈ [x0, 0]

R3 g(x) ≥ 0 for all x ∈ [0,∞)

Now result R3 implies that for all x ∈ [0,∞]

G1(x) =

∫ x

0

g(t)dt ≥ 0 .

Result R2 implies that for all x ∈ [x0, 0]

G1(x) =

∫ x

0

g(t)dt = −∫ 0

x

g(t)dt ≥ 0 .

Result R1 implies that for all x ∈ [xmin, x0]

G1(x) = −G2(x) = −∫ xmin

x

g(t)dt =

∫ x

xmin

g(t)dt ≥ 0 .

So for case 2 we have again shown the result that G1(x) ≥ 0 for all x ∈[xmin,∞).

The following is a proof of Theorem 16.2.2 from Chapter 16.

Proof. In order to simplify the notation of the proof, we may with out lossof generality assume that x′ = 0 and f(x′) = 0. In this case, it must thenbe that xmin < 0 and b = 0. Also, since f(x) is convex and f ′(x) is concaveboth must also be continuous functions of [xmin,∞).

Now in this case, Q(0; 0) = f(0) = 0, so in order to show that Q isa surrogate for the minimization of f(x), we need only show that for all

Page 404: Model Based Image Processing (Text)

394 Proofs of Poisson Surrogates

x ∈ [xmin,∞) that Q(x; 0) ≥ f(x). To do this, we start by defining theconvex function g(t) = ct− f ′(t). Then we can show that

Q(x; x′)− f(x) =c

2x2 −

∫ x

0

f ′(t)dt

=

∫ x

0

(ct− f ′(t)) dt

=

∫ x

0

g(t)dt .

Furthermore if we define the function

G1(x) =

∫ x

0

g(t)dt ,

then if we can show that G1(x) ≥ 0 for all x ∈ [xmin,∞), then we know that

Q(x; x′)− f(x) = G1(x) ≥ 0 , (C.2)

and we have proved the result that Q is a surrogate for the minimization off(x).

By the specific choice of c from equation (16.21), it is easily show thatg(xmin) = 0. Therefore, since g(t) is convex and g(0) = 0, we know that thefollowing results must hold.

R1 g(x) ≤ 0 for all x ∈ [xmin, 0]

R2 g(x) ≥ 0 for all x ∈ [0,∞)

Now result R2 implies that for all x ∈ [0,∞]

G1(x) =

∫ x

0

g(t)dt ≥ 0 .

Result R1 implies that for all x ∈ [xmin, 0]

G1(x) =

∫ x

0

g(t)dt = −∫ 0

x

g(t)dt ≥ 0 .

So we have shown the result that G1(x) ≥ 0 for all x ∈ [xmin,∞).

Page 405: Model Based Image Processing (Text)

Appendix D

Notation

General Notation:

1. Reals - R

2. Integers - Z

3. Non-negative Reals - R+

4. N dimensional Non-negative Reals - R+N

5. Non-negative Integers - Z+

6. Gradient is a column vector!

7. Vector norm ||x||

8. Definition ,

9. Expectation E[X]

10. Expectation Eθ[X]

11. Variance Var[X]

12. Circular convolution xn ⊛ hn

13. Column vector of 1’s, 1.

14. Column vector of 0’s, 0.

15. Approximately equal x ≈ y

Page 406: Model Based Image Processing (Text)

396 Notation

16. Interior of set int(S)

17. clipx, [a, b] - clips the value x to the interval [a, b]

18. clipx,Ω - projects the vector x onto the convex set Ω.

19. clip

x,R+N

- enforce positivity constraint on x.

Page 407: Model Based Image Processing (Text)

397

Probability (Chapter 2) Notation:

• Y or X ∈ Rp - multivariate Gaussian observations

• X1, · · · , Xn - i.i.d. samples from a distribution

• P (A) - Probability of an event A ⊂ Ω

• PX ≤ t - Probability of the event A = ω ∈ Ω : X(ω) ≤ t

• P

X1+Y ≤ t

- Probability of the event A =

ω ∈ Ω : X(ω)1+Y (ω) ≤ t

Page 408: Model Based Image Processing (Text)

398 Notation

Gaussian prior models (Chapters 3 and 4) Notation:

• n ∈ [1, · · · , N ] - 1-D index set

• s = (s1, s2) ∈ [1, · · · , N ]2 - 2-D index set with s1 being the row and s2being the column.

• s ∈ S - arbitrary index set

• N = |S| - number of elements in lattice

• Xn - random process in 1 or more dimensions

• Es - causal or non-causal prediction error

• Causal notation

– H - causal predictor matrix

– A = I −H - causal predictor matrix

– E = AX = (I −H)X - causal prediction error

– Λ - diagonal matrix of causal prediction variances

– hi,j or hi−j - causal prediction filter

– Fn = Xi : i < n - past observations– H(ω) - DTFT of causal prediction filter

• Non-causal notation

– G - non-causal predictor matrix

– B = I −G - non-causal predictor matrix

– E = BX = (I −G)X - non-causal prediction error

– Γ - diagonal matrix of non-causal prediction variances

– gi,j or gi−j - non-causal prediction filter

– G(ω) - DTFT of causal prediction filter

Page 409: Model Based Image Processing (Text)

399

MAP Estimation with Gaussian priors (Chapters 5) Notation:

• Y ∈ RN - Measured data

• X ∈ RN - Unknown Image

• A ∈ RN×N - System matrix

• W ∼ N(0, σ2I) - Additive noise vector

• εs - unit vector in direction of sth coordinate.

• f(x) - MAP cost function

• ∇f(x) - gradient of MAP cost function

Page 410: Model Based Image Processing (Text)

400 Notation

Non-Gaussian prior models (Chapters 6) Notation:

• ρ(∆) - potential function

• ρ′(∆) - influence function

• ρ′′(∆) - derivative of influence function

Page 411: Model Based Image Processing (Text)

401

MAP Estimation with non-Gaussian priors (Chapters 7) Nota-tion:

• Y ∈ RM - Measured data

• X ∈ RN - Unknown Image

• X ∈ R+N - positivity constraint on unknown Image

• X ∈ Ω - general convex constraint on unknown image

• A ∈ RM×N - System matrix

• W ∼ N(0, σ2I) - Additive noise vector

• Q(x; x′) - surrogate function for f(x)

• ρ(∆;∆′) - surrogate function for potential function ρ(∆)

Page 412: Model Based Image Processing (Text)

402 Notation

Constrained Optimization for MAP Estimation (Chapters 9) No-tation:

• x ∈ Ω ⊂ RN - Unknown Image were Ω is closed with non-empty interior

• λ ∈ D ⊂ RK - Lagrange parameter where D is convex

Page 413: Model Based Image Processing (Text)

403

EM Algorithm (Chapter 11) Notation:

• 1 ≤ n ≤ N - time index and range

• 0 ≤ m < M - state index and range

• Rp - observation space

• Yn ∈ Rp for n = 1, · · · , N - observed data and associated space

• Xn ∈ Ω with |Ω| = M - unobserved data and associated space

• θ(k) - result of kth EM iteration

• Nm, bm, Rm - sufficient statistics for each class

• Nm, bm, Rm - expected sufficient statistics for each class

• p - dimension of observation vector

• θ, θ - new and old parameters respectively

• πm, µm, σ2m - parameters for mth mixture component

• θ = [π0, µ0, σ20, · · · , πM−1, µM−1, σ2

M−1] - full parameter vector

Page 414: Model Based Image Processing (Text)

404 Notation

Markov Chain and HMM (Chapter 12) Notation:

• Xn - discrete time Markov chain

• 0 ≤ n ≤ N with X0 being the initial state

• π(n)j = PXn = j - state distribution at time n

• P(n)i,j - nonhomogeneous state transition probability

• τj = π(0)j - initial state distribution

• Nj = δ(X0 − j) - initial state statistics

• Kj =∑N

n=1 δ(Xn − j) =∑M−1

i=0 Ki,j - state membership statistics

• Ki,j =∑N

n=1 δ(Xn − j)δ(Xn−1 − i) - state transition statistics

• bj =∑N−1

n=0 ynδ(xn − j) - first order class statistics

• Sj =∑N−1

n=0 ynytnδ(xn − j) - second order class statistics

• Ω = [0, · · · ,M − 1] - set of discrete states

• θ = [τj, Pi,j : for i, j ∈ Ω] - parameter vector

• πj - ergodic distribution of Markov chain

Page 415: Model Based Image Processing (Text)

405

General MRF Models (Chapter 13) Notation:

• T - temperature in Gibbs distribution

• C - set of cliques in MRF

• Cs - set of cliques which contain the pixel xs

• z - partition function in Gibbs distribution

• u(x) - energy function

• Vc(xc) for c ∈ C - potential function for clique c

• Xs ∈ Ω for s ∈ S - discrete random field

• Xs ∈ 0, · · · ,M − 1 for s ∈ S - discrete random field

• Xn ∈ 0, · · · ,M − 1 for n ∈ 0, · · · , N − 1 - discrete random field

Page 416: Model Based Image Processing (Text)

406 Notation

MAP Segmentation (Chapter 15) Notation:

• Ys ∈ Rp for n = 1, · · · , N - observed data

• Xs ∈ Ω with |Ω| = 0, · · · ,M − 1 - unobserved class label

• s ∈ S - pixel index space

• l(ys|xs) = − log pys|xs(ys|xs) - negative log likelihood ratio for each pixel

• θm = πm,j, µm,j, Bm,jJ−1j=0 - parameters of Gaussian mixture

• T - temperature in Gibbs distribution

Page 417: Model Based Image Processing (Text)

407

Modeling Poisson Data (Chapter 16) Notation:

• Yi ∼ Pois(Ai,∗x) for i = 1, · · · , N - observed data

• Xj for j = 1, · · · , N - unobserved rates

• l(x) = − log py|x(y|x) - negative log likelihood ratio

Page 418: Model Based Image Processing (Text)

408 Notation

Advanced Models (Chapter 17) Notation:

Page 419: Model Based Image Processing (Text)

Bibliography

[1] S. Alliney and S. A. Ruzinsky. An algorithm for the minimization of mixed l1 and l2 normswith application to Bayesian estimation. IEEE Trans. on Signal Processing, 42(3):618–627,March 1994.

[2] L. Baum, T. Petrie, G. Soules, and N. Weiss. A maximization technique occurring in the statis-tical analysis of probabilistic functions of Markov chains. Ann. Math. Statistics, 41(1):164–171,1970.

[3] L. E. Baum and T. Petrie. Statistical inference for probabilistic functions of finite state Markovchains. Ann. Math. Statistics, 37:1554–1563, 1966.

[4] D. P. Bertsekas. Convex Analysis and Optimization. Athena Scientific, 2003.

[5] D. P. Bertsekas and J. N. Tsitsiklis. Parallel and Distributed Computation: Numerical Methods.Prentice-Hall, 1989.

[6] J. Besag. Spatial interaction and the statistical analysis of lattice systems. Journal of the

Royal Statistical Society B, 36(2):192–236, 1974.

[7] J. Besag. Efficiency of pseudolikelihood estimation for simple Gaussian fields. Biometrica,64(3):616–618, 1977.

[8] J. Besag. On the statistical analysis of dirty pictures. Journal of the Royal Statistical Society

B, 48(3):259–302, 1986.

[9] J. Besag. Towards Bayesian image analysis. Journal of Applied Statistics, 16(3):395–407, 1989.

[10] A. Blake. Comparison of the efficiency of deterministic and stochastic algorithms for visual re-construction. IEEE Trans. on Pattern Analysis and Machine Intelligence, 11(1):2–30, January1989.

[11] A. Blake and A. Zisserman. Visual Reconstruction. MIT Press, Cambridge, Massachusetts,1987.

[12] C. A. Bouman and B. Liu. Multiple resolution segmentation of textured images. IEEE Trans.

on Pattern Analysis and Machine Intelligence, 13(2):99–113, February 1991.

[13] C. A. Bouman and K. Sauer. A generalized Gaussian image model for edge-preserving MAPestimation. IEEE Trans. on Image Processing, 2(3):296–310, July 1993.

[14] S. Boyd, N. Parikh, E. Chu, B. Peleato, and J. Eckstein. Distributed optimization and statisti-cal learning via the alternating direction method of multipliers. Found. Trends Mach. Learn.,3(1):1–122, Jan. 2011.

Page 420: Model Based Image Processing (Text)

410 BIBLIOGRAPHY

[15] S. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press, CambridgeUK, 2009.

[16] Y. Boykov and V. Kolmogorov. An experimental comparison of min-cut/max-flow algorithmsfor energy minimization in vision. IEEE Trans. on Pattern Analysis and Machine Intelligence,26(9):1124–1137, 2004.

[17] M. L. Comer and E. J. Delp. The em/mpm algorithm for segmentation of textured images:Analysis and further experimental results. IEEE Trans. on Image Processing, 9(10):1731–1744,October 2000.

[18] H. Derin, H. Elliott, R. Cristi, and D. Geman. Bayes smoothing algorithms for segmentationof binary images modeled by Markov random fields. IEEE Trans. on Pattern Analysis and

Machine Intelligence, PAMI-6(6):707–719, November 1984.

[19] J. Eckstein. Augmented lagrangian and alternating directions methods for convex optimiza-tion: A tutorial and some illustrative computational results. Technical Report RRR 32-2012,RUTCOR Rutgers Center for Operations Research, Rutger University, Rutger University, De-cember 2012.

[20] H. Feng, W. C. Karl, and D. A. Castanon. A curve evolution approach to object-basedtomographic reconstruction. IEEE Trans. on Image Processing, 12(1):44–57, March 2003.

[21] J. Fessler, E. Ficaro, N. Clinthorne, and K. Lange. Grouped-coordinate ascent algorithms forpenalized-likelihood transmi ssion image reconstruction. IEEE Trans. on Medical Imaging,16(2):166–175, April 1997.

[22] L. R. Ford and D. R. Fulkerson. Flows in Networks. Princeton University Press, Princeton,NJ, 1962.

[23] M. Fortin and R. Glowinski. On Decomposition-coordination methods using an augmented

Lagrangian. North-Holland: Amsterdam, 1983.

[24] T. Frese, C. A. Bouman, and K. Sauer. Multiscale Bayesian methods for discrete tomography.In G. T. Herman and A. Kuba, editors, Discrete Tomography: Foundations, Algorithms and

Applications, pages 237–261. Birkhauser Boston, Cambridge, MA, 1999.

[25] D. Gabay. Applications of the Method of Multipliers to Variational Inequalities. North-Holland:Amsterdam, 1983.

[26] D. Geman and G. Reynolds. Constrained restoration and the recovery of discontinuities. IEEETrans. on Pattern Analysis and Machine Intelligence, 14(3):367–383, March 1992.

[27] D. Geman and C. Yang. Nonlinear image recovery with half-quadratic regularization. IEEE

Trans. Image Processing, 4(7):932–946, 1975.

[28] S. Geman and D. Geman. Stochastic relaxation, Gibbs distributions and the Bayesian restora-tion of images. IEEE Trans. on Pattern Analysis and Machine Intelligence, PAMI-6:721–741,November 1984.

[29] S. Geman and C. Graffigne. Markov random field image models and their applications tocomputer vision. In Proc. of the Intl Congress of Mathematicians, pages 1496–1517, Berkeley,CA, 1986.

Page 421: Model Based Image Processing (Text)

BIBLIOGRAPHY 411

[30] S. Geman and D. McClure. Bayesian images analysis: An application to single photon emissiontomography. In Proc. Statist. Comput. sect. Amer. Stat. Assoc., pages 12–18, Washington,DC, 1985.

[31] S. Geman and D. McClure. Statistical methods for tomographic image reconstruction. Bull.

Int. Stat. Inst., LII-4:5–21, 1987.

[32] P. J. Green. Bayesian reconstruction from emission tomography data using a modified EMalgorithm. IEEE Trans. on Medical Imaging, 9(1):84–93, March 1990.

[33] P. J. Green and X. liang Han. Metropolis methods, Gaussian proposals and antithetic variables.In P. Barone, A. Frigessi, and M. Piccioni, editors, Stochastic Models, Statistical methods, and

Algorithms in Image Analysis, pages 142–164. Springer-Verlag, Berlin, 1992.

[34] D. Greig, B. Porteous, and A. Seheult. Exact maximum a posteriori estimation for binaryimages. J. R. Statist. Soc. B, 51(2):271–278, 1989.

[35] W. K. Hastings. Monte Carlo sampling methods using Markov chains and their applications.Biometrika, 57(1):97–109, 1970.

[36] T. Hebert and R. Leahy. A generalized EM algorithm for 3-D Bayesian reconstruction fromPoisson data using Gibbs priors. IEEE Trans. on Medical Imaging, 8(2):194–202, June 1989.

[37] M. R. Hestenes. Multiplier and gradient methods. Journal of Optimization Theory and Ap-

plications, 4(5):303–320, 1969.

[38] P. J. Huber. Robust Statistics. Wiley, New York, 1981.

[39] E. Ising. Beitrag zur theorie des ferromagnetismus. Z. Phys., 31:253258, 1925.

[40] L. Kantorovich and G. Akilov. Functional Analysis in Normed Spaces. Fitzmatgiz, Moscow,1959.

[41] Z. Kato, M. Berthod, and J. Zerubia. Parallel image classification using multiscale Markovrandom fields. In Proc. of IEEE Int’l Conf. on Acoust., Speech and Sig. Proc., volume 5, pages137–140, Minneapolis, MN, April 27-30 1993.

[42] R. Kindermann and J. Snell. Markov Random Fields and their Applications. American Math-ematical Society, Providence, 1980.

[43] W. Lenz. Beitrage zum verstandnis der magnetischen eigenschaften in festen korpern.Physikalische Zeitschrift, page 613615, 1921.

[44] D. G. Luenberger. Linear and Nonlinear Programming. Addison-Wesley Publishing Company,Reading Massachusetts, 1989.

[45] J. Marroquin, S. Mitter, and T. Poggio. Probabilistic solution of ill-posed problems in com-putational vision. Journal of the American Statistical Association, 82:76–89, March 1987.

[46] N. Metropolis, A. Rosenbluth, M. Rosenbluth, A. Teller, and E. Teller. Equations of statecalculations by fast computing machines. J. Chem. Phys., 21:1087–1091, 1953.

Page 422: Model Based Image Processing (Text)

412 BIBLIOGRAPHY

[47] A. Mohammad-Djafari. Joint estimation of parameters and hyperparameters in a Bayesianapproach of solving inverse problems. In Proc. of IEEE Int’l Conf. on Image Proc., volume II,pages 473–476, Lausanne, Switzerland, September 16-19 1996.

[48] L. Onsager. Crystal statistics i. a two-dimensional model. Physical Review Letters, 65:117–149,1944.

[49] J. M. Ortega and W. C. Rheinoboldt. Iterative Solutions of Nonlinear Equations in Several

Variables, pages 253–255. Academic, New York, 1970.

[50] R. E. Peierls. Statistical theory of adsorption with interaction between the adsorbed atoms.Proc. Camb. Phil. Soc., 32:471–476, 1936.

[51] P. H. Peskun. Optimum Monte-Carlo sampling using Markov chains. Biometrika, 60(3):607–612, 1973.

[52] A. R. D. Pierro. A modified expectation maximization algorithm for penalized likelihoodestimation in emission tomography. IEEE Trans. Med. Imaging, 14(1):132–137, 1995.

[53] M. J. D. Powell. A Method for Nonlinear Constraints in Minimization Problems, pages 283–298. Academic Press, New York, 1969.

[54] E. Redner and H. Walker. Mixture densities, maximum likelihood and the EM algorithm.SIAM Review, 26(2), April 1984.

[55] S. M. Ross. Stochastic Processes. John Wiley & Sons, New York, 1983.

[56] L. Rudin, S. Oscher, and E. Fatemi. Nonlinear total variation based noise removal algorithms.Phys. D, 60:259–268, November 1992.

[57] K. Sauer and C. Bouman. Bayesian estimation of transmission tomograms using segmentationbased optimization. IEEE Trans. on Nuclear Science, 39:1144–1152, 1992.

[58] K. Sauer and C. A. Bouman. A local update strategy for iterative reconstruction from pro-jections. IEEE Trans. on Signal Processing, 41(2):534–548, February 1993.

[59] L. Shepp and Y. Vardi. Maximum likelihood reconstruction for emission tomography. IEEE

Trans. on Medical Imaging, MI-1(2):113–122, October 1982.

[60] S. Silvey. Statistical Inference. Chapman and Hall, London, 1975.

[61] M. Slater. Lagrange multipliers revisisted. Technical Report 80, Cowles Foundation for Re-search in Economics, Yale University, November 1950.

[62] H. Sohrab. Basic Real Analysis. Springer New York, 2014.

[63] R. Stevenson and E. Delp. Fitting curves with discontinuities. Proc. of the first international

workshop on robust computer vision, pages 127–136, October 1-3 1990.

[64] J.-B. Thibault, K. Sauer, C. Bouman, and J. Hsieh. A three-dimensional statistical approach toimproved image quality for multi-slice helical ct. Medical Physics, 34(11):4526–4544, November2007.

Page 423: Model Based Image Processing (Text)

BIBLIOGRAPHY 413

[65] R. Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical

Society. Series B, 58(1):267288, 1996.

[66] A. Tikhonov and V. Arsenin. Solutions of Ill-Posed Problems. Winston and Sons, New York,1977.

[67] E. Wong and B. Hajek. Stochastic Processes in Engineering Systems. Springer Texts inElectrical Engineering. Springer New York Inc., 1985.

[68] J. Woods, S. Dravida, and R. Mediavilla. Image estimation using double stochastic Gaussianrandom field models. IEEE Trans. on Pattern Analysis and Machine Intelligence, PAMI-9(2):245–253, March 1987.

[69] C. Wu. On the convergence properties of the EM algorithm. Annals of Statistics, 11(1):95–103,1983.

[70] Z. Yu, J.-B. Thibault, C. A. Bouman, K. D. Sauer, and J. Hsieh. Fast model-based x-rayct reconstruction using spatially nonhomogeneous icd optimization. IEEE Trans. on Image

Processing, 20(1):161–175, 2011.

[71] J. Zheng, S. S. Saquib, K. Sauer, and C. A. Bouman. Parallelizable Bayesian tomographyalgorithms with rapid, guaranteed convergence. IEEE Trans. on Image Processing, 9(10):1745–1759, Oct. 2000.